From 5c35712800fb621c953fe3092cd0480bb02487be Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sat, 28 Mar 2009 22:38:19 +0000 Subject: [PATCH] Check for invalid handle on tracker errors/warnings --- deluge/core/torrentmanager.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 5f9c19db7..6181d2a5c 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -704,7 +704,11 @@ class TorrentManager(component.Component): def on_alert_tracker_warning(self, alert): log.debug("on_alert_tracker_warning") # Get the torrent_id - torrent_id = str(alert.handle.info_hash()) + try: + torrent_id = str(alert.handle.info_hash()) + except RuntimeError: + log.debug("Invalid torrent handle.") + return tracker_status = '%s: %s' % (_("Warning"), str(alert.message())) # Set the tracker status for the torrent try: @@ -714,7 +718,12 @@ class TorrentManager(component.Component): def on_alert_tracker_error(self, alert): log.debug("on_alert_tracker_error") - torrent = self.torrents[str(alert.handle.info_hash())] + try: + torrent_id = str(alert.handle.info_hash()) + except RuntimeError: + log.debug("Invalid torrent handle.") + return + torrent = self.torrents[torrent_id] tracker_status = "%s: %s" % (_("Error"), alert.msg) try: torrent.set_tracker_status(tracker_status)