Skip to content

Commit 86453b8

Browse files
committed
SDL: Check for _mSDLOpenJoystick null return
1 parent 40cae51 commit 86453b8

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/platform/sdl/sdl-events.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,10 @@ void mSDLUpdateJoysticks(struct mSDLEvents* events, const struct Configuration*
396396
events->players[i]->joystick = NULL;
397397
}
398398
struct SDL_JoystickCombo* joystick = _mSDLOpenJoystick(events, event.jdevice.which);
399+
if (!joystick) {
400+
mLOG(SDL_EVENTS, ERROR, "SDL joystick hotplug attach failed: %s", SDL_GetError());
401+
continue;
402+
}
399403

400404
for (i = 0; i < events->playersAttached && i < MAX_PLAYERS; ++i) {
401405
if (joysticks[i] != -1) {

0 commit comments

Comments
 (0)