فهرست منبع

Fixed crash if info->path is NULL

(cherry picked from commit 715301cef5835b14c37267055e13a6b02d66ab1a)
Sam Lantinga 1 ماه پیش
والد
کامیت
3f13c0b36d
1فایلهای تغییر یافته به همراه2 افزوده شده و 4 حذف شده
  1. 2 4
      src/joystick/hidapi/SDL_hidapijoystick.c

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

@@ -868,10 +868,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;