Explorar o código

Check return value of VIRTUAL_HWDataForIndex()

Mingjie Shen %!s(int64=2) %!d(string=hai) anos
pai
achega
bf8c9d2d70
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/joystick/virtual/SDL_virtualjoystick.c

+ 1 - 1
src/joystick/virtual/SDL_virtualjoystick.c

@@ -585,7 +585,7 @@ static SDL_bool VIRTUAL_JoystickGetGamepadMapping(int device_index, SDL_GamepadM
     Uint8 current_button = 0;
     Uint8 current_axis = 0;
 
-    if (hwdata->desc.type != SDL_JOYSTICK_TYPE_GAMEPAD) {
+    if (!hwdata || hwdata->desc.type != SDL_JOYSTICK_TYPE_GAMEPAD) {
         return SDL_FALSE;
     }