mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
Merge pull request #3776 from birarda/hydra-crash
don't try to open joystick if controller is NULL
This commit is contained in:
commit
a1e8848525
1 changed files with 6 additions and 3 deletions
|
@ -52,9 +52,12 @@ JoystickScriptingInterface::JoystickScriptingInterface() :
|
|||
|
||||
for (int i = 0; i < joystickCount; i++) {
|
||||
SDL_GameController* controller = SDL_GameControllerOpen(i);
|
||||
SDL_JoystickID id = getInstanceId(controller);
|
||||
Joystick* joystick = new Joystick(id, SDL_GameControllerName(controller), controller);
|
||||
_openJoysticks[id] = joystick;
|
||||
|
||||
if (controller) {
|
||||
SDL_JoystickID id = getInstanceId(controller);
|
||||
Joystick* joystick = new Joystick(id, SDL_GameControllerName(controller), controller);
|
||||
_openJoysticks[id] = joystick;
|
||||
}
|
||||
}
|
||||
|
||||
_isInitialized = true;
|
||||
|
|
Loading…
Reference in a new issue