From db6246e35977ba75a7ef8090b85a84bf474b8a00 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 1 May 2021 22:20:23 -0700 Subject: [PATCH] Fixes error on empty search results --- bookwyrm/views/search.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bookwyrm/views/search.py b/bookwyrm/views/search.py index 4b9100fb..558c2039 100644 --- a/bookwyrm/views/search.py +++ b/bookwyrm/views/search.py @@ -56,10 +56,11 @@ class Search(View): results = endpoints[search_type]( query, request.user, min_confidence, search_remote ) - paginated = Paginator(results, PAGE_LENGTH).get_page( - request.GET.get("page") - ) - data["results"] = paginated + if results: + paginated = Paginator(results, PAGE_LENGTH).get_page( + request.GET.get("page") + ) + data["results"] = paginated return TemplateResponse(request, "search/{:s}.html".format(search_type), data)