From 7242d753eb93ce6b6425ec55249cdc5ca70fb000 Mon Sep 17 00:00:00 2001 From: Nintorch <92302738+Nintorch@users.noreply.github.com> Date: Mon, 1 Jun 2026 00:05:25 +0500 Subject: [PATCH] Fix web joystick vibration (again) --- src/joystick/emscripten/SDL_sysjoystick.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/joystick/emscripten/SDL_sysjoystick.c b/src/joystick/emscripten/SDL_sysjoystick.c index 80ae01c46d..00a4c0bbba 100644 --- a/src/joystick/emscripten/SDL_sysjoystick.c +++ b/src/joystick/emscripten/SDL_sysjoystick.c @@ -506,7 +506,7 @@ static bool EMSCRIPTEN_JoystickOpen(SDL_Joystick *joystick, int device_index) item->rumble_available = MAIN_THREAD_EM_ASM_INT({ let gamepad = navigator['getGamepads']()[$0]; - return gamepad && gamepad['vibrationActuator']; // Don't check the vibrationActuator.effects array here, because it's not defined in Safari + return gamepad && 'vibrationActuator' in gamepad; // Don't check the vibrationActuator.effects array here, because it's not defined in Safari }, item->index); if (item->rumble_available) { @@ -516,7 +516,7 @@ static bool EMSCRIPTEN_JoystickOpen(SDL_Joystick *joystick, int device_index) item->trigger_rumble_available = MAIN_THREAD_EM_ASM_INT({ let gamepad = navigator['getGamepads']()[$0]; // This effect is not supported in Safari, so it's okay for us to check the vibrationActuator.effects array here for the browsers that do support it - return gamepad && gamepad['vibrationActuator'] && gamepad['vibrationActuator']['effects'] && gamepad['vibrationActuator']['effects']['includes']('trigger-rumble'); + return gamepad && 'vibrationActuator' in gamepad && 'effects' in gamepad['vibrationActuator'] && gamepad['vibrationActuator']['effects']['includes']('trigger-rumble'); }, item->index); if (item->trigger_rumble_available) {