mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-13 07:03:54 +00:00
Android: prevent removing joystick if SDL hasn't been initialized yet
This commit is contained in:
@@ -497,6 +497,12 @@ void Android_RemoveJoystick(int device_id)
|
||||
SDL_joylist_item *item = SDL_joylist;
|
||||
SDL_joylist_item *prev = NULL;
|
||||
|
||||
// Java might notify us about joysticks being removed before joysticks have
|
||||
// been initialized.
|
||||
if (!SDL_JoysticksInitialized()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_LockJoysticks();
|
||||
|
||||
// Don't call JoystickByDeviceId here or there'll be an infinite loop!
|
||||
|
||||
Reference in New Issue
Block a user