summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcos Pinto <markybob@dipconsultants.com>2007-10-23 22:14:22 +0000
committerMarcos Pinto <markybob@dipconsultants.com>2007-10-23 22:14:22 +0000
commitf143d52f66b90780d23042b52cc456a2593d885b (patch)
tree0cee3df948f31ebcaace4137f19615c7e40d07eb
parentbc9cfe94d5b0e73ab276af9a9fb983c2bd70de71 (diff)
downloaddeluge-f143d52f66b90780d23042b52cc456a2593d885b.tar.gz
deluge-f143d52f66b90780d23042b52cc456a2593d885b.tar.bz2
deluge-f143d52f66b90780d23042b52cc456a2593d885b.zip
only replace tracker if handle is valid
-rw-r--r--src/deluge_core.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp
index 630e1aef7..3c9d1b174 100644
--- a/src/deluge_core.cpp
+++ b/src/deluge_core.cpp
@@ -1779,18 +1779,17 @@ static PyObject *torrent_replace_trackers(PyObject *self, PyObject *args)
return NULL;
torrent_handle& h = M_torrents->at(index).handle;
-
- std::vector<libtorrent::announce_entry> trackerlist;
-
- std::istringstream trackers(tracker);
- std::string line;
-
- while (std::getline(trackers, line)) {
- libtorrent::announce_entry a_entry(line);
- trackerlist.push_back(a_entry);
+ if (h.is_valid()){
+ std::vector<libtorrent::announce_entry> trackerlist;
+ std::istringstream trackers(tracker);
+ std::string line;
+ while (std::getline(trackers, line)) {
+ libtorrent::announce_entry a_entry(line);
+ trackerlist.push_back(a_entry);
+ }
+ h.replace_trackers(trackerlist);
+ h.force_reannounce();
}
- h.replace_trackers(trackerlist);
- h.force_reannounce();
Py_INCREF(Py_None); return Py_None;
}
static PyObject *torrent_prioritize_files(PyObject *self, PyObject *args)