Selaa lähdekoodia

Fixed crash if info->path is NULL

Sam Lantinga 6 kuukautta sitten
vanhempi
commit
715301cef5
1 muutettua tiedostoa jossa 2 lisäystä ja 4 poistoa
  1. 2 4
      src/joystick/hidapi/SDL_hidapijoystick.c

+ 2 - 4
src/joystick/hidapi/SDL_hidapijoystick.c

@@ -871,10 +871,8 @@ static SDL_HIDAPI_Device *HIDAPI_AddDevice(const struct SDL_hid_device_info *inf
         return NULL;
     }
     SDL_SetObjectValid(device, SDL_OBJECT_TYPE_HIDAPI_JOYSTICK, true);
-    device->path = SDL_strdup(info->path);
-    if (!device->path) {
-        SDL_free(device);
-        return NULL;
+    if (info->path) {
+        device->path = SDL_strdup(info->path);
     }
     device->seen = true;
     device->vendor_id = info->vendor_id;