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

This commit is contained in:
Sam Lantinga 2021-01-21 22:32:17 -08:00
parent 3527b49459
commit bf53651d73
1 changed files with 4 additions and 0 deletions

View File

@ -966,6 +966,10 @@ void SDL_EnableGameCubeAdaptors(void)
ssize_t i, num_devs; ssize_t i, num_devs;
int kernel_detached = 0; int kernel_detached = 0;
if (libusb_ctx.libhandle == NULL) {
return;
}
if (libusb_init(&usb_context) == 0) { if (libusb_init(&usb_context) == 0) {
num_devs = libusb_get_device_list(usb_context, &devs); num_devs = libusb_get_device_list(usb_context, &devs);
for (i = 0; i < num_devs; ++i) { for (i = 0; i < num_devs; ++i) {