Commit bf53651d737f3182f7961f32fb3b085014f4d9b1

Sam Lantinga 2021-01-21T22:32:17

Make sure we only do GameCube adapter initialization if we were able to load libusb

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c
index 670a517..365ebe8 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) {