Fix crash when trying to add a bad .torrent.

This commit is contained in:
Andrew Resch 2007-12-30 04:00:53 +00:00
parent 5a175587f4
commit aa932b56a7
1 changed files with 5 additions and 1 deletions

View File

@ -141,7 +141,11 @@ class TorrentManager(component.Component):
# joined.
if type(filedump) is not str:
filedump = "".join(chr(b) for b in filedump)
filedump = lt.bdecode(filedump)
try:
filedump = lt.bdecode(filedump)
except RuntimeError, e:
log.warn("Unable to decode torrent file: %s", e)
return None
else:
# Get the data from the file
filedump = self.load_torrent(filename)