mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-08-26 08:31:39 +00:00
Fixed two cases where joystick/haptic objects should be marked invalid on error during open.
This commit is contained in:
@@ -367,6 +367,7 @@ SDL_Haptic *SDL_OpenHapticFromJoystick(SDL_Joystick *joystick)
|
||||
if (SDL_HIDAPI_JoystickIsHaptic(joystick)) {
|
||||
if (!SDL_HIDAPI_HapticOpenFromJoystick(haptic, joystick)) {
|
||||
SDL_SetError("Haptic: SDL_HIDAPI_HapticOpenFromJoystick failed.");
|
||||
SDL_SetObjectValid(haptic, SDL_OBJECT_TYPE_HAPTIC, false);
|
||||
SDL_free(haptic);
|
||||
SDL_UnlockJoysticks();
|
||||
return NULL;
|
||||
|
||||
@@ -950,6 +950,7 @@ static SDL_HIDAPI_Device *HIDAPI_AddDevice(const struct SDL_hid_device_info *inf
|
||||
}
|
||||
|
||||
if (!device->name) {
|
||||
SDL_SetObjectValid(device, SDL_OBJECT_TYPE_HIDAPI_JOYSTICK, false);
|
||||
SDL_free(device->manufacturer_string);
|
||||
SDL_free(device->product_string);
|
||||
SDL_free(device->serial);
|
||||
|
||||
Reference in New Issue
Block a user