Procházet zdrojové kódy

Fixed crash with a NULL serial number

Sam Lantinga před 2 roky
rodič
revize
18046b9aa3
1 změnil soubory, kde provedl 8 přidání a 0 odebrání
  1. 8 0
      src/joystick/hidapi/SDL_hidapijoystick.c

+ 8 - 0
src/joystick/hidapi/SDL_hidapijoystick.c

@@ -534,6 +534,10 @@ HIDAPI_HasConnectedUSBDevice(const char *serial)
 {
     SDL_HIDAPI_Device *device;
 
+    if (!serial) {
+        return SDL_FALSE;
+    }
+
     for (device = SDL_HIDAPI_devices; device; device = device->next) {
         if (!device->driver) {
             continue;
@@ -555,6 +559,10 @@ HIDAPI_DisconnectBluetoothDevice(const char *serial)
 {
     SDL_HIDAPI_Device *device;
 
+    if (!serial) {
+        return;
+    }
+
     for (device = SDL_HIDAPI_devices; device; device = device->next) {
         if (!device->driver) {
             continue;