diff --git a/src/states_screens/options_screen_input2.cpp b/src/states_screens/options_screen_input2.cpp index 699c38bcc..9e2dc5cbf 100644 --- a/src/states_screens/options_screen_input2.cpp +++ b/src/states_screens/options_screen_input2.cpp @@ -431,10 +431,10 @@ void OptionsScreenInput2::gotSensedInput(const Input& sensed_input) } } + GamePadDevice *gpad = input_manager->getDeviceManager() + ->getGamePadFromIrrID(sensed_input.m_device_id); - std::string gamepad_name = input_manager->getDeviceManager() - ->getGamePadFromIrrID(sensed_input.m_device_id) - ->getName(); + std::string gamepad_name = gpad ? gpad->getName() : "UNKNOWN DEVICE"; if (m_config->getName() == gamepad_name) { GamepadConfig* config = (GamepadConfig*)m_config;