SDL: Check for _mSDLOpenJoystick null return

This commit is contained in:
Vicki Pfau 2025-04-09 19:09:27 -07:00
parent 40cae51e28
commit 86453b8107
1 changed files with 4 additions and 0 deletions
src/platform/sdl

View File

@ -396,6 +396,10 @@ void mSDLUpdateJoysticks(struct mSDLEvents* events, const struct Configuration*
events->players[i]->joystick = NULL;
}
struct SDL_JoystickCombo* joystick = _mSDLOpenJoystick(events, event.jdevice.which);
if (!joystick) {
mLOG(SDL_EVENTS, ERROR, "SDL joystick hotplug attach failed: %s", SDL_GetError());
continue;
}
for (i = 0; i < events->playersAttached && i < MAX_PLAYERS; ++i) {
if (joysticks[i] != -1) {