Qt: Fix crash when editing shortcuts with none selected (fixes #1964)
Vicki Pfau vi@endrift.com
Thu, 03 Dec 2020 20:45:21 -0800
2 files changed,
4 insertions(+),
3 deletions(-)
M
CHANGES
→
CHANGES
@@ -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.cpp
→
src/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));