Fixed crash with a NULL serial number

This commit is contained in:
Sam Lantinga 2022-09-26 20:53:50 -07:00
parent 67fa6a935f
commit 18046b9aa3
1 changed files with 8 additions and 0 deletions

View File

@ -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;