mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-25 15:58:08 +00:00
core/ui: fix crash when trying to scroll with only one page
This commit is contained in:
parent
8ee605484e
commit
1e7357db80
@ -21,9 +21,9 @@ async def change_page(page, page_count):
|
|||||||
else:
|
else:
|
||||||
s = await swipe
|
s = await swipe
|
||||||
if s == SWIPE_UP:
|
if s == SWIPE_UP:
|
||||||
return page + 1 # scroll down
|
return min(page + 1, page_count - 1) # scroll down
|
||||||
elif s == SWIPE_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):
|
async def paginate(render_page, page_count, page=0, *args):
|
||||||
|
Loading…
Reference in New Issue
Block a user