diff options
author | Mai M <mathew1800@gmail.com> | 2021-12-14 23:42:07 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-14 23:42:07 -0500 |
commit | f0ed11e3180f9d241881576ac2f62e50dddd7804 (patch) | |
tree | d400260e24cde5fbea0144be468f288937ff5884 /src/yuzu/applets/qt_software_keyboard.cpp | |
parent | 935fee18ed6d375154d01e126843470a48ec1dbc (diff) | |
parent | 96579e515a8da3eb6c1aab13a4d4ff5d9577605a (diff) |
Merge pull request #7579 from Morph1984/swkbd-oob-array-access
qt_software_keyboard: Fix out of bounds array access
Diffstat (limited to 'src/yuzu/applets/qt_software_keyboard.cpp')
-rw-r--r-- | src/yuzu/applets/qt_software_keyboard.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/yuzu/applets/qt_software_keyboard.cpp b/src/yuzu/applets/qt_software_keyboard.cpp index de7f98c4f..c3857fc98 100644 --- a/src/yuzu/applets/qt_software_keyboard.cpp +++ b/src/yuzu/applets/qt_software_keyboard.cpp @@ -475,11 +475,26 @@ void QtSoftwareKeyboardDialog::open() { row = 0; column = 0; - const auto* const curr_button = - keyboard_buttons[static_cast<int>(bottom_osk_index)][row][column]; + switch (bottom_osk_index) { + case BottomOSKIndex::LowerCase: + case BottomOSKIndex::UpperCase: { + const auto* const curr_button = + keyboard_buttons[static_cast<std::size_t>(bottom_osk_index)][row][column]; + + // This is a workaround for setFocus() randomly not showing focus in the UI + QCursor::setPos(curr_button->mapToGlobal(curr_button->rect().center())); + break; + } + case BottomOSKIndex::NumberPad: { + const auto* const curr_button = numberpad_buttons[row][column]; - // This is a workaround for setFocus() randomly not showing focus in the UI - QCursor::setPos(curr_button->mapToGlobal(curr_button->rect().center())); + // This is a workaround for setFocus() randomly not showing focus in the UI + QCursor::setPos(curr_button->mapToGlobal(curr_button->rect().center())); + break; + } + default: + break; + } StartInputThread(); } |