mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-29 01:08:44 +00:00
Android: prevent removing joystick if SDL hasn't been initialized yet
This commit is contained in:
parent
3f80c0b82a
commit
9986c89da0
1 changed files with 6 additions and 0 deletions
|
|
@ -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!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue