menu: Fix NULL dereference when DEFAULT_ENTRY is out of range with TIMEOUT=0
diff --git a/common/menu.c b/common/menu.c
index f6974860..4f2e73a9 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -1205,7 +1205,7 @@ noreturn void _menu(bool first_run) {
}
if (!skip_timeout && !timeout) {
- if (max_entries == 0 || selected_menu_entry->sub != NULL) {
+ if (max_entries == 0 || selected_menu_entry == NULL || selected_menu_entry->sub != NULL) {
quiet = false;
print("Default entry is not valid or directory, booting to menu.\n");
skip_timeout = true;
