mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-15 18:57:51 +00:00
Fixed crash if the controller product name is NULL
This happens when the Razer Synapse software emulates a controller with a keyboard (cherry picked from commit7117d545a3) (cherry picked from commit7f880c9121)
This commit is contained in:
parent
4568e64d9e
commit
ca8e33375b
1 changed files with 4 additions and 2 deletions
|
|
@ -2495,7 +2495,7 @@ SDL_JoystickGUID SDL_CreateJoystickGUID(Uint16 bus, Uint16 vendor, Uint16 produc
|
|||
*guid16++ = SDL_SwapLE16(bus);
|
||||
*guid16++ = SDL_SwapLE16(crc);
|
||||
|
||||
if (vendor && product) {
|
||||
if (vendor) {
|
||||
*guid16++ = SDL_SwapLE16(vendor);
|
||||
*guid16++ = 0;
|
||||
*guid16++ = SDL_SwapLE16(product);
|
||||
|
|
@ -2511,7 +2511,9 @@ SDL_JoystickGUID SDL_CreateJoystickGUID(Uint16 bus, Uint16 vendor, Uint16 produc
|
|||
guid.data[14] = driver_signature;
|
||||
guid.data[15] = driver_data;
|
||||
}
|
||||
SDL_strlcpy((char *)guid16, product_name, available_space);
|
||||
if (product_name) {
|
||||
SDL_strlcpy((char *)guid16, product_name, available_space);
|
||||
}
|
||||
}
|
||||
return guid;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue