Skip to content

Commit 2c48c01

Browse files
committed
input: add null check
1 parent d72856c commit 2c48c01

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/input/gamepad_device.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ void GamepadDevice::load_system_mappings()
550550
for (int i = 0; i < GetGamepadCount(); i++)
551551
{
552552
std::shared_ptr<GamepadDevice> gamepad = GetGamepad(i);
553-
if (!gamepad->find_mapping())
553+
if (gamepad != nullptr && !gamepad->find_mapping())
554554
gamepad->resetMappingToDefault(settings.platform.isArcade(), true);
555555
}
556556
}
@@ -580,6 +580,8 @@ std::string GamepadDevice::make_mapping_filename(bool instance, int system, bool
580580

581581
bool GamepadDevice::find_mapping(int system /* = settings.platform.system */)
582582
{
583+
// FIXME this is called on Event::Start in the game loader thread
584+
// race condition with the UI thread?
583585
if (!_remappable)
584586
return true;
585587
instanceMapping = false;

0 commit comments

Comments
 (0)