cellSaveData/overlays: prevent possible array out of bounds in list view

This commit is contained in:
Megamouse 2019-08-25 08:06:56 +02:00
parent eed32cf3a4
commit 32b5b11a83
3 changed files with 24 additions and 3 deletions

View file

@ -208,6 +208,12 @@ static error_code select_and_delete(ppu_thread& ppu)
save_entries.erase(save_entries.cbegin() + selected);
selected = -1;
// Reset the focused index if the new list is empty
if (save_entries.empty())
{
focused = -1;
}
// Display success message (return value should be irrelevant here)
msg = "Successfully removed entry!\n\n" + info;
cellSaveData.success("%s", msg);