mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-31 05:56:24 +08:00
Fix bug #9331 - SDL3 Android crash getVibrator() == null
(cherry picked from commit 1855ce68af)
This commit is contained in:
@@ -546,13 +546,15 @@ class SDLHapticHandler {
|
|||||||
if (haptic == null) {
|
if (haptic == null) {
|
||||||
InputDevice device = InputDevice.getDevice(deviceIds[i]);
|
InputDevice device = InputDevice.getDevice(deviceIds[i]);
|
||||||
Vibrator vib = device.getVibrator();
|
Vibrator vib = device.getVibrator();
|
||||||
if (vib.hasVibrator()) {
|
if (vib != null) {
|
||||||
haptic = new SDLHaptic();
|
if (vib.hasVibrator()) {
|
||||||
haptic.device_id = deviceIds[i];
|
haptic = new SDLHaptic();
|
||||||
haptic.name = device.getName();
|
haptic.device_id = deviceIds[i];
|
||||||
haptic.vib = vib;
|
haptic.name = device.getName();
|
||||||
mHaptics.add(haptic);
|
haptic.vib = vib;
|
||||||
SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name);
|
mHaptics.add(haptic);
|
||||||
|
SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user