From 179ba241155592045b8cb9b1674d9c194c2f8a4f Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Fri, 23 Apr 2021 15:29:55 -0700 Subject: [PATCH] Safely handle invalid book --- bookwyrm/templatetags/bookwyrm_tags.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bookwyrm/templatetags/bookwyrm_tags.py b/bookwyrm/templatetags/bookwyrm_tags.py index 2d95904f0..bd14a410f 100644 --- a/bookwyrm/templatetags/bookwyrm_tags.py +++ b/bookwyrm/templatetags/bookwyrm_tags.py @@ -171,6 +171,8 @@ def get_next_shelf(current_shelf): @register.filter(name="title") def get_title(book): """ display the subtitle if the title is short """ + if not book: + return "" title = book.title if len(title) < 6 and book.subtitle: title = "{:s}: {:s}".format(title, book.subtitle)