Ignore type errors when sorting device collections

Invalid data in the device database on sony readers could cause errors
when sorting device collections, ignore those errors.
This commit is contained in:
Kovid Goyal 2013-07-08 10:30:34 +05:30
parent a41a945e8f
commit a8deb4b1f8

View File

@ -283,11 +283,17 @@ class CollectionsBookList(BookList):
return -1
if isinstance(x, basestring) and isinstance(y, basestring):
x, y = sort_key(force_unicode(x)), sort_key(force_unicode(y))
try:
c = cmp(x, y)
except TypeError:
c = 0
if c != 0:
return c
# same as above -- no sort_key needed here
try:
return cmp(xx[2], yy[2])
except TypeError:
return 0
for category, lpaths in collections.items():
books = lpaths.values()