From 6acc14d31b5faf681b8d67593fea42932f701bfa Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sat, 20 Feb 2016 22:21:37 -0800 Subject: [PATCH] SDL: Fix potential joystick crash in games with rumble --- CHANGES | 1 + src/platform/sdl/sdl-events.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 8ff4ab5ce..972f11763 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,7 @@ Bugfixes: - OpenGL: Correct boolean vector strcmp strings for uniforms - Wii: Fix tilting direction - SDL: Fix joystick initialization on BS + - SDL: Fix potential joystick crash in games with rumble Misc: - GBA: Slightly optimize GBAProcessEvents - Qt: Add preset for DualShock 4 diff --git a/src/platform/sdl/sdl-events.c b/src/platform/sdl/sdl-events.c index ed958eebc..68bc95398 100644 --- a/src/platform/sdl/sdl-events.c +++ b/src/platform/sdl/sdl-events.c @@ -572,7 +572,7 @@ void mSDLHandleEvent(struct mCoreThread* context, struct mSDLPlayer* sdlContext, #if SDL_VERSION_ATLEAST(2, 0, 0) static void _mSDLSetRumble(struct mRumble* rumble, int enable) { struct mSDLRumble* sdlRumble = (struct mSDLRumble*) rumble; - if (!sdlRumble->p->joystick->haptic || !SDL_HapticRumbleSupported(sdlRumble->p->joystick->haptic)) { + if (!sdlRumble->p->joystick || !sdlRumble->p->joystick->haptic || !SDL_HapticRumbleSupported(sdlRumble->p->joystick->haptic)) { return; } sdlRumble->level += enable;