From 022235012c0e9c58becacdbb1d748124d68bc7d2 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 2 Aug 2021 16:40:58 -0700
Subject: [PATCH] Fixed crash if WGI didn't give us the name for a controller
---
src/joystick/windows/SDL_windows_gaming_input.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/joystick/windows/SDL_windows_gaming_input.c b/src/joystick/windows/SDL_windows_gaming_input.c
index c48a56635..ad68ab3e3 100644
--- a/src/joystick/windows/SDL_windows_gaming_input.c
+++ b/src/joystick/windows/SDL_windows_gaming_input.c
@@ -206,6 +206,9 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeAdde
}
__x_ABI_CWindows_CGaming_CInput_CIRawGameController2_Release(controller2);
}
+ if (!name) {
+ name = "";
+ }
hr = __x_ABI_CWindows_CGaming_CInput_CIRawGameController_QueryInterface(controller, &IID_IGameController, (void **)&gamecontroller);
if (SUCCEEDED(hr)) {