diff options
| author | Sam Lantinga <slouken@libsdl.org> | 2021-01-21 22:32:17 -0800 |
|---|---|---|
| committer | Sam Lantinga <slouken@libsdl.org> | 2021-01-21 22:32:17 -0800 |
| commit | 8bda77e2792afd4ab77bdb0c1c8d22d569b4791e (patch) | |
| tree | e2bb5bef52ae975318f45c1aab862781ea56807c /src/hidapi/SDL_hidapi.c | |
| parent | 2ed279adcac59b855f22b9084a7a194a0afeda01 (diff) | |
| download | sdl-8bda77e2792afd4ab77bdb0c1c8d22d569b4791e.tar.gz | |
Make sure we only do GameCube adapter initialization if we were able to load libusb
Diffstat (limited to 'src/hidapi/SDL_hidapi.c')
| -rw-r--r-- | src/hidapi/SDL_hidapi.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c index 670a51719..365ebe855 100644 --- a/src/hidapi/SDL_hidapi.c +++ b/src/hidapi/SDL_hidapi.c @@ -966,6 +966,10 @@ void SDL_EnableGameCubeAdaptors(void) ssize_t i, num_devs; int kernel_detached = 0; + if (libusb_ctx.libhandle == NULL) { + return; + } + if (libusb_init(&usb_context) == 0) { num_devs = libusb_get_device_list(usb_context, &devs); for (i = 0; i < num_devs; ++i) { |
