testcontroller: Fix crash when unplugging a controller while calibrating gyro
This commit is contained in:
1 parent
52e12046f6
commit
4037c258a1
1 file changed
+2
-2
@@ -2208,9 +2208,9 @@ SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, SDL_Event *event)
|
||||
}
|
||||
|
||||
if (display_mode == CONTROLLER_MODE_TESTING) {
|
||||
if (GamepadButtonContains(GetGyroResetButton(gyro_elements), event->button.x, event->button.y)) {
|
||||
if (controller && GamepadButtonContains(GetGyroResetButton(gyro_elements), event->button.x, event->button.y)) {
|
||||
ResetGyroOrientation(controller->imu_state);
|
||||
} else if (GamepadButtonContains(GetGyroCalibrateButton(gyro_elements), event->button.x, event->button.y)) {
|
||||
} else if (controller && GamepadButtonContains(GetGyroCalibrateButton(gyro_elements), event->button.x, event->button.y)) {
|
||||
BeginNoiseCalibrationPhase(controller->imu_state);
|
||||
} else if (GamepadButtonContains(setup_mapping_button, event->button.x, event->button.y)) {
|
||||
SetDisplayMode(CONTROLLER_MODE_BINDING);
|
||||
|
||||
Reference in new issue
Block a user