mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-01 07:28:30 +00:00
Fixed crash if the controller product name is NULL
This happens when the Razer Synapse software emulates a controller with a keyboard
This commit is contained in:
@@ -2581,7 +2581,7 @@ SDL_JoystickGUID SDL_CreateJoystickGUID(Uint16 bus, Uint16 vendor, Uint16 produc
|
|||||||
*guid16++ = SDL_SwapLE16(bus);
|
*guid16++ = SDL_SwapLE16(bus);
|
||||||
*guid16++ = SDL_SwapLE16(crc);
|
*guid16++ = SDL_SwapLE16(crc);
|
||||||
|
|
||||||
if (vendor && product) {
|
if (vendor) {
|
||||||
*guid16++ = SDL_SwapLE16(vendor);
|
*guid16++ = SDL_SwapLE16(vendor);
|
||||||
*guid16++ = 0;
|
*guid16++ = 0;
|
||||||
*guid16++ = SDL_SwapLE16(product);
|
*guid16++ = SDL_SwapLE16(product);
|
||||||
@@ -2597,8 +2597,10 @@ SDL_JoystickGUID SDL_CreateJoystickGUID(Uint16 bus, Uint16 vendor, Uint16 produc
|
|||||||
guid.data[14] = driver_signature;
|
guid.data[14] = driver_signature;
|
||||||
guid.data[15] = driver_data;
|
guid.data[15] = driver_data;
|
||||||
}
|
}
|
||||||
|
if (product_name) {
|
||||||
SDL_strlcpy((char *)guid16, product_name, available_space);
|
SDL_strlcpy((char *)guid16, product_name, available_space);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return guid;
|
return guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user