diff --git a/src/platform/qt/GamepadAxisEvent.cpp b/src/platform/qt/GamepadAxisEvent.cpp index 833e82f3f..f35256097 100644 --- a/src/platform/qt/GamepadAxisEvent.cpp +++ b/src/platform/qt/GamepadAxisEvent.cpp @@ -20,7 +20,7 @@ GamepadAxisEvent::GamepadAxisEvent(int axis, Direction direction, bool isNew, in , m_key(GBA_KEY_NONE) { ignore(); - if (controller) { + if (controller && controller->map()) { m_key = static_cast(mInputMapAxis(controller->map(), type, axis, direction * INT_MAX)); } } diff --git a/src/platform/qt/GamepadButtonEvent.cpp b/src/platform/qt/GamepadButtonEvent.cpp index f789becb6..184dae591 100644 --- a/src/platform/qt/GamepadButtonEvent.cpp +++ b/src/platform/qt/GamepadButtonEvent.cpp @@ -19,7 +19,7 @@ GamepadButtonEvent::GamepadButtonEvent(QEvent::Type pressType, int button, int t , m_key(GBA_KEY_NONE) { ignore(); - if (controller) { + if (controller && controller->map()) { m_key = static_cast(mInputMapKey(controller->map(), type, button)); } } diff --git a/src/platform/qt/GamepadHatEvent.cpp b/src/platform/qt/GamepadHatEvent.cpp index 65c9a633c..6844b63c5 100644 --- a/src/platform/qt/GamepadHatEvent.cpp +++ b/src/platform/qt/GamepadHatEvent.cpp @@ -20,7 +20,7 @@ GamepadHatEvent::GamepadHatEvent(QEvent::Type pressType, int hatId, Direction di , m_key(GBA_KEY_NONE) { ignore(); - if (controller) { + if (controller && controller->map()) { m_key = static_cast(mInputMapHat(controller->map(), type, hatId, direction)); } } diff --git a/src/platform/qt/input/InputController.cpp b/src/platform/qt/input/InputController.cpp index b241f8e1f..cbcd465a7 100644 --- a/src/platform/qt/input/InputController.cpp +++ b/src/platform/qt/input/InputController.cpp @@ -366,6 +366,9 @@ void InputController::updateJoysticks() { } const mInputMap* InputController::map() { + if (!m_activeKeyInfo) { + return nullptr; + } return &m_inputMap; }