From 32700294e27ffb97b188d8a401e90ed1494e50f3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 28 Aug 2022 17:56:11 -0700 Subject: [PATCH] Don't crash if SDL_CreateJoystickGUID() is passed a NULL name --- src/joystick/SDL_joystick.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 49bd2f0b7..72d28b8ef 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -1981,6 +1981,10 @@ SDL_CreateJoystickGUID(Uint16 bus, Uint16 vendor, Uint16 product, Uint16 version SDL_zero(guid); + if (!name) { + name = ""; + } + /* We only need 16 bits for each of these; space them out to fill 128. */ /* Byteswap so devices get same GUID on little/big endian platforms. */ *guid16++ = SDL_SwapLE16(bus);