From 1e7357db8026346c8d4651c8b5b969eed9df04c0 Mon Sep 17 00:00:00 2001 From: matejcik Date: Thu, 18 Apr 2019 15:03:24 +0200 Subject: [PATCH] core/ui: fix crash when trying to scroll with only one page --- core/src/trezor/ui/scroll.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/trezor/ui/scroll.py b/core/src/trezor/ui/scroll.py index 89d2fad39b..d144f76d7c 100644 --- a/core/src/trezor/ui/scroll.py +++ b/core/src/trezor/ui/scroll.py @@ -21,9 +21,9 @@ async def change_page(page, page_count): else: s = await swipe if s == SWIPE_UP: - return page + 1 # scroll down + return min(page + 1, page_count - 1) # scroll down elif s == SWIPE_DOWN: - return page - 1 # scroll up + return max(page - 1, 0) # scroll up async def paginate(render_page, page_count, page=0, *args):