all repos — mgba @ e31de6b4702a141c962f07ceb5a881ef923078fa

mGBA Game Boy Advance Emulator

Qt: Fix crash when editing shortcuts with none selected (fixes #1964)
Vicki Pfau vi@endrift.com
Thu, 03 Dec 2020 20:45:21 -0800
commit

e31de6b4702a141c962f07ceb5a881ef923078fa

parent

542404b7fa59d7aaef7c2aded10d3fa8e9708924

2 files changed, 4 insertions(+), 3 deletions(-)

jump to
M CHANGESCHANGES

@@ -77,6 +77,7 @@ - Qt: Fix game display sometimes disappearing after closing load/save state screen

- Qt: Fix cancelling pausing before the frame ends - Qt: Fix gamepad event dispatching (fixes mgba.io/i/1922) - Qt: Pre-attach GDB stub when launching with -g (fixes mgba.io/i/1950) + - Qt: Fix crash when editing shortcuts with none selected (fixes mgba.io/i/1964) - SM83: Simplify register pair access on big endian - SM83: Disassemble STOP as one byte - Wii: Fix crash on unloading irregularly sized GBA ROMs
M src/platform/qt/ShortcutView.cppsrc/platform/qt/ShortcutView.cpp

@@ -87,7 +87,7 @@ }

QModelIndex index = m_ui.shortcutTable->selectionModel()->currentIndex(); QString name = m_model->name(index); const Shortcut* item = m_controller->shortcut(name); - if (!item->action()) { + if (!item || !item->action()) { return; } if (m_ui.gamepadButton->isChecked()) {

@@ -106,7 +106,7 @@ return;

} QString name = m_model->name(m_ui.shortcutTable->selectionModel()->currentIndex()); const Shortcut* item = m_controller->shortcut(name); - if (!item->action()) { + if (!item || !item->action()) { return; } if (m_ui.gamepadButton->isChecked()) {

@@ -122,7 +122,7 @@ return;

} QString name = m_model->name(m_ui.shortcutTable->selectionModel()->currentIndex()); const Shortcut* item = m_controller->shortcut(name); - if (!item->action()) { + if (!item || !item->action()) { return; } m_controller->updateAxis(name, axis, static_cast<GamepadAxisEvent::Direction>(direction));