try to catch invalid handle in deluge_core
This commit is contained in:
parent
3ea3b6b5b0
commit
8dfb4b73eb
@ -1787,23 +1787,26 @@ static PyObject *torrent_replace_trackers(PyObject *self, PyObject *args)
|
|||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (M_torrents->at(index).handle.is_valid()){
|
try {
|
||||||
std::vector<libtorrent::announce_entry> trackerlist;
|
if (M_torrents->at(index).handle.is_valid()){
|
||||||
std::istringstream trackers(tracker);
|
std::vector<libtorrent::announce_entry> trackerlist;
|
||||||
std::string line;
|
std::istringstream trackers(tracker);
|
||||||
while (std::getline(trackers, line)) {
|
std::string line;
|
||||||
libtorrent::announce_entry a_entry(line);
|
while (std::getline(trackers, line)) {
|
||||||
trackerlist.push_back(a_entry);
|
libtorrent::announce_entry a_entry(line);
|
||||||
|
trackerlist.push_back(a_entry);
|
||||||
|
}
|
||||||
|
if (trackerlist.empty()){
|
||||||
|
std::vector<libtorrent::announce_entry> empty;
|
||||||
|
M_torrents->at(index).handle.replace_trackers(empty);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
M_torrents->at(index).handle.replace_trackers(trackerlist);
|
||||||
|
M_torrents->at(index).handle.force_reannounce();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (trackerlist.empty()){
|
}
|
||||||
std::vector<libtorrent::announce_entry> empty;
|
catch (libtorrent::invalid_handle&) {}
|
||||||
M_torrents->at(index).handle.replace_trackers(empty);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
M_torrents->at(index).handle.replace_trackers(trackerlist);
|
|
||||||
M_torrents->at(index).handle.force_reannounce();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Py_INCREF(Py_None); return Py_None;
|
Py_INCREF(Py_None); return Py_None;
|
||||||
}
|
}
|
||||||
static PyObject *torrent_prioritize_files(PyObject *self, PyObject *args)
|
static PyObject *torrent_prioritize_files(PyObject *self, PyObject *args)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user