Qt: Fix input crashes when no game was loaded
Vicki Pfau vi@endrift.com
Wed, 12 Jul 2017 20:20:04 -0700
4 files changed,
6 insertions(+),
3 deletions(-)
M
src/platform/qt/GamepadAxisEvent.cpp
→
src/platform/qt/GamepadAxisEvent.cpp
@@ -20,7 +20,7 @@ , m_controller(controller)
, m_key(GBA_KEY_NONE) { ignore(); - if (controller) { + if (controller && controller->map()) { m_key = static_cast<GBAKey>(mInputMapAxis(controller->map(), type, axis, direction * INT_MAX)); } }
M
src/platform/qt/GamepadButtonEvent.cpp
→
src/platform/qt/GamepadButtonEvent.cpp
@@ -19,7 +19,7 @@ , m_controller(controller)
, m_key(GBA_KEY_NONE) { ignore(); - if (controller) { + if (controller && controller->map()) { m_key = static_cast<GBAKey>(mInputMapKey(controller->map(), type, button)); } }
M
src/platform/qt/GamepadHatEvent.cpp
→
src/platform/qt/GamepadHatEvent.cpp
@@ -20,7 +20,7 @@ , m_controller(controller)
, m_key(GBA_KEY_NONE) { ignore(); - if (controller) { + if (controller && controller->map()) { m_key = static_cast<GBAKey>(mInputMapHat(controller->map(), type, hatId, direction)); } }
M
src/platform/qt/input/InputController.cpp
→
src/platform/qt/input/InputController.cpp
@@ -366,6 +366,9 @@ #endif
} const mInputMap* InputController::map() { + if (!m_activeKeyInfo) { + return nullptr; + } return &m_inputMap; }