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