Просмотр исходного кода

Fixed crash if WGI didn't give us the name for a controller

Sam Lantinga 4 лет назад
Родитель
Сommit
022235012c
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      src/joystick/windows/SDL_windows_gaming_input.c

+ 3 - 0
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);
             __x_ABI_CWindows_CGaming_CInput_CIRawGameController2_Release(controller2);
         }
         }
+        if (!name) {
+            name = "";
+        }
 
 
         hr = __x_ABI_CWindows_CGaming_CInput_CIRawGameController_QueryInterface(controller, &IID_IGameController, (void **)&gamecontroller);
         hr = __x_ABI_CWindows_CGaming_CInput_CIRawGameController_QueryInterface(controller, &IID_IGameController, (void **)&gamecontroller);
         if (SUCCEEDED(hr)) {
         if (SUCCEEDED(hr)) {