From bf53651d737f3182f7961f32fb3b085014f4d9b1 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 21 Jan 2021 22:32:17 -0800 Subject: [PATCH] Make sure we only do GameCube adapter initialization if we were able to load libusb --- src/hidapi/SDL_hidapi.c | 4 ++++ 1 file changed, 4 insertions(+) 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) {