---
main.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/main.c b/main.c
index 8f27c46..af75f25 100644
--- a/main.c
+++ b/main.c
@@ -7791,7 +7791,7 @@ optionsinput(uint8_t inputs)
|| state.options.pos == 19) {
if (state.options.page == state.options.userlen / 20 + 1) {
state.options.page = 0;
- } else {
+ } else if (state.options.userlen > 0) {
++state.options.page;
}
draw_options_page();
@@ -7805,8 +7805,12 @@ optionsinput(uint8_t inputs)
if (state.options.pos == 0) {
uint8_t pos;
if (state.options.page == 0) {
- state.options.page = state.options.userlen / 20 + 1;
- pos = MIN(19, state.options.userlen % 20 - 1);
+ if (state.options.userlen > 0) {
+ state.options.page = state.options.userlen / 20 + 1;
+ pos = MIN(19, state.options.userlen % 20 - 1);
+ } else {
+ pos = OPT_LAST;
+ }
} else {
--state.options.page;
pos = state.options.page > 0 ? 19 : OPT_LAST;
--
2.38.4
This doesn't work for me? Wrapping around on page 1 works, but pressing
either flip button goes to an empty page 2, when it should either do
nothing or jump to the top of page 1 (whichever is easier to implement I
guess).