Fixed crash in game controller support code

Joystick's startup and shutdown (of Native OS X backend) can be called more than once
This commit is contained in:
alexey.lysiuk 2014-12-26 22:11:03 +02:00
parent 4f383e5aa7
commit 0d1c954bc0
1 changed files with 6 additions and 0 deletions

View File

@ -739,6 +739,11 @@ IOKitJoystickManager* s_joystickManager;
void I_StartupJoysticks()
{
if (NULL != s_joystickManager)
{
return;
}
// HID Manager API is available on 10.5 (Darwin 9.x) or newer
if (darwinVersion.major >= 9)
@ -750,6 +755,7 @@ void I_StartupJoysticks()
void I_ShutdownJoysticks()
{
delete s_joystickManager;
s_joystickManager = NULL;
}
void I_GetJoysticks( TArray< IJoystickConfig* >& sticks )