From b507000921d39416ec102bdbd5313f27d525b7c7 Mon Sep 17 00:00:00 2001 From: rachmadaniHaryono Date: Fri, 16 Oct 2020 19:19:15 +0800 Subject: [PATCH] fix: dev: index error on bookmark --- bukuserver/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bukuserver/views.py b/bukuserver/views.py index 05a3373..24bad71 100644 --- a/bukuserver/views.py +++ b/bukuserver/views.py @@ -219,7 +219,10 @@ class BookmarkModelView(BaseModelView): bookmarks = sorted(bookmarks, key=lambda x: x[key_idx], reverse=sort_desc) count = len(bookmarks) if page_size and bookmarks: - bookmarks = list(chunks(bookmarks, page_size))[page] + try: + bookmarks = list(chunks(bookmarks, page_size))[page] + except IndexError: + bookmarks = [] data = [] for bookmark in bookmarks: bm_sns = SimpleNamespace(id=None, url=None, title=None, tags=None, description=None)