From 6c2f86b7b71105688af82362e2ffbaf49ea76262 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Mon, 23 Nov 2015 18:49:20 +0100 Subject: [PATCH] Fix crash when books in GST don't have ratings --- src/calibre/db/categories.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/db/categories.py b/src/calibre/db/categories.py index f209138f54..6db8befa1d 100644 --- a/src/calibre/db/categories.py +++ b/src/calibre/db/categories.py @@ -213,7 +213,7 @@ def get_categories(dbcache, sort='name', book_ids=None, first_letter_sort=False) total_rating = 0 count = 0 for id_ in t.id_set: - rating = book_rating_map[id_] + rating = book_rating_map.get(id_, 0) if rating: total_rating += rating/2 count += 1