Fix #7491 (Error after subscribing to TidBITS: Mac News... news source)

This commit is contained in:
Kovid Goyal 2010-11-10 23:20:17 -07:00
parent 247723eaca
commit f40f555d13
2 changed files with 12 additions and 2 deletions

View File

@ -1014,7 +1014,13 @@ class DeviceMixin(object): # {{{
self.status_bar.show_message(_('Sent by email:') + ', '.join(good), self.status_bar.show_message(_('Sent by email:') + ', '.join(good),
5000) 5000)
if remove: if remove:
self.library_view.model().delete_books_by_id(remove) try:
self.library_view.model().delete_books_by_id(remove)
except:
# Probably the user deleted the files, in any case, failing
# to delete the book is not catastrophic
traceback.print_exc()
def cover_to_thumbnail(self, data): def cover_to_thumbnail(self, data):
ht = self.device_manager.device.THUMBNAIL_HEIGHT \ ht = self.device_manager.device.THUMBNAIL_HEIGHT \

View File

@ -625,7 +625,11 @@ class ResultCache(SearchQueryParser): # {{{
# }}} # }}}
def remove(self, id): def remove(self, id):
self._data[id] = None try:
self._data[id] = None
except IndexError:
# id is out of bounds, no point setting it to None anyway
pass
try: try:
self._map.remove(id) self._map.remove(id)
except ValueError: except ValueError: