Skip to content

Commit 46a51b4

Browse files
committed
Fixed crash if info->path is NULL
(cherry picked from commit 715301c)
1 parent 4f488b9 commit 46a51b4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/joystick/hidapi/SDL_hidapijoystick.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -890,10 +890,8 @@ static SDL_HIDAPI_Device *HIDAPI_AddDevice(const struct SDL_hid_device_info *inf
890890
return NULL;
891891
}
892892
device->magic = &SDL_HIDAPI_device_magic;
893-
device->path = SDL_strdup(info->path);
894-
if (!device->path) {
895-
SDL_free(device);
896-
return NULL;
893+
if (info->path) {
894+
device->path = SDL_strdup(info->path);
897895
}
898896
device->seen = SDL_TRUE;
899897
device->vendor_id = info->vendor_id;

0 commit comments

Comments
 (0)