From 37fcf4ec4df74b13a07576508346b1fce1232897 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Mon, 7 Apr 2008 21:10:44 +0000 Subject: [PATCH] Catch a couple more exceptions. --- deluge/core/torrentmanager.py | 7 ++++++- deluge/core/torrentqueue.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 4bad7aae4..f2df2d858 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -213,7 +213,12 @@ class TorrentManager(component.Component): self.config["torrentfiles_location"], filename + ".fastresume"), "rb") - fastresume = lt.bdecode(_file.read()) + try: + fastresume = lt.bdecode(_file.read()) + except RuntimeError, e: + log.warning("Unable to bdecode fastresume file: %s", e) + fastresume = None + _file.close() except IOError, e: log.debug("Unable to load .fastresume: %s", e) diff --git a/deluge/core/torrentqueue.py b/deluge/core/torrentqueue.py index c19c548e2..dc0a13a2d 100644 --- a/deluge/core/torrentqueue.py +++ b/deluge/core/torrentqueue.py @@ -229,7 +229,7 @@ class TorrentQueue(component.Component): try: value = self.queue[position] - except KeyError: + except KeyError, IndexError: self.queue.insert(position, torrent_id) return position