Author: andar

Revision: 4933

Log:
        Check for invalid handle on tracker errors/warnings

Diff:
Modified: trunk/deluge/core/torrentmanager.py
===================================================================
--- trunk/deluge/core/torrentmanager.py 2009-03-28 04:03:17 UTC (rev 4932)
+++ trunk/deluge/core/torrentmanager.py 2009-03-28 22:38:19 UTC (rev 4933)
@@ -704,7 +704,11 @@
     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 @@
 
     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)



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to