ui/selgame.cpp, ui/selsoft.cpp: Clear up std::vector asserts triggered when menu items is empty. (#10085)

This commit is contained in:
jflatt 2022-07-15 08:53:17 -07:00 committed by GitHub
parent 24c2f80c83
commit 26f30a12a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -442,7 +442,7 @@ void menu_select_game::populate(float &customtop, float &custombottom)
item_append(_("System Settings"), 0, (void *)(uintptr_t)CONF_MACHINE);
skip_main_items = 3;
if (m_prev_selected && !have_prev_selected)
if (m_prev_selected && !have_prev_selected && item_count() > 0)
m_prev_selected = item(0).ref();
}
else

View File

@ -397,7 +397,7 @@ menu_select_software::~menu_select_software()
void menu_select_software::handle(event const *ev)
{
if (m_prev_selected == nullptr)
if (m_prev_selected == nullptr && item_count() > 0)
m_prev_selected = item(0).ref();
// FIXME: everything above here used run before events were processed