fix array index out of bounds crash in EmulatorWindow::ProcessControllerHotkey

This commit is contained in:
gmriggs 2023-05-19 15:26:19 -04:00
parent 1319ff6ead
commit 85a93029a7
1 changed files with 3 additions and 2 deletions

View File

@ -1304,8 +1304,9 @@ EmulatorWindow::ControllerHotKey EmulatorWindow::ProcessControllerHotkey(
break;
}
if (button_combination.function == ButtonFunctions::IncTitleSelect ||
button_combination.function == ButtonFunctions::DecTitleSelect) {
if ((button_combination.function == ButtonFunctions::IncTitleSelect ||
button_combination.function == ButtonFunctions::DecTitleSelect) &&
recently_launched_titles_.size() > 0) {
selected_title_index = std::clamp(
selected_title_index, 0, (int)recently_launched_titles_.size() - 1);