From b5ea33e5066629e2b22b937920d8bf2da49bcfd8 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sun, 8 May 2011 21:35:06 +0100 Subject: [PATCH] On some "race" conditions, the torrent is removed before it's status could be retrieved. Return an empty status. --- deluge/core/core.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deluge/core/core.py b/deluge/core/core.py index 42fa0f4b3..8a4d3f384 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -421,7 +421,11 @@ class Core(component.Component): @export def get_torrent_status(self, torrent_id, keys, diff=False): # Build the status dictionary - status = self.torrentmanager[torrent_id].get_status(keys, diff) + try: + status = self.torrentmanager[torrent_id].get_status(keys, diff) + except KeyError: + # Torrent was probaly removed meanwhile + return {} # Get the leftover fields and ask the plugin manager to fill them leftover_fields = list(set(keys) - set(status.keys()))