From 253b62b7cf67354ca22fb47b4f0ef90f3c07c5bc Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 15 Jun 2025 23:41:34 +0200 Subject: [PATCH] fixed crash bugs (caused by dereferencing null pointer) --- src/screens.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/screens.c b/src/screens.c index 4ac66a28..0bb36843 100644 --- a/src/screens.c +++ b/src/screens.c @@ -4678,7 +4678,7 @@ void HandleInfoScreen_Generic(int mx, int my, int dx, int dy, int button) else if (button == MB_MENU_CONTINUE) { // if space key was pressed, show next page of info screen, if available - if (wrapped_text->line_visible_last < wrapped_text->num_lines - 1) + if (wrapped_text != NULL && wrapped_text->line_visible_last < wrapped_text->num_lines - 1) HandleInfoScreen(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); else HandleInfoScreen(0, 0, 0, 0, MB_MENU_CHOICE); @@ -4710,8 +4710,9 @@ void HandleInfoScreen_Generic(int mx, int my, int dx, int dy, int button) FadeIn(REDRAW_FIELD); } } - else if ((dy < 0 && wrapped_text->line_visible_first > 0) || - (dy > 0 && wrapped_text->line_visible_last < wrapped_text->num_lines - 1)) + else if (wrapped_text != NULL && + ((dy < 0 && wrapped_text->line_visible_first > 0) || + (dy > 0 && wrapped_text->line_visible_last < wrapped_text->num_lines - 1))) { if (ABS(dy) == SCROLL_PAGE) { -- 2.34.1