aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradnano <me@adnano.co>2024-02-26 16:31:41 -0500
committeradnano <me@adnano.co>2024-02-26 16:31:41 -0500
commitf9167689dcd4ab0231bacdcdf0173747fb6a738b (patch)
tree5e8a21ec348a4d475fae19e92b455b31195993dd
parentc6025455ec7a5a2ce0367097d465c7188759886b (diff)
downloadwmenu-f9167689dcd4ab0231bacdcdf0173747fb6a738b.tar.gz
Check if selection is not null before dereferencing
-rw-r--r--main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/main.c b/main.c
index c288e99..94de88f 100644
--- a/main.c
+++ b/main.c
@@ -714,14 +714,14 @@ static void keypress(struct menu *menu, enum wl_keyboard_key_state key_state,
break;
case XKB_KEY_Page_Up:
case XKB_KEY_KP_Page_Up:
- if (menu->sel->page->prev) {
+ if (menu->sel && menu->sel->page->prev) {
menu->sel = menu->sel->page->prev->first;
render_frame(menu);
}
break;
case XKB_KEY_Page_Down:
case XKB_KEY_KP_Page_Down:
- if (menu->sel->page->next) {
+ if (menu->sel && menu->sel->page->next) {
menu->sel = menu->sel->page->next->first;
render_frame(menu);
}