Linux: Fix fallback logic when udev fails creating a context

Thanks to Noshyaar for pointing out the bug.
This commit is contained in:
Rémi Verschelde 2021-02-18 10:28:37 +01:00
parent 9d84e3b395
commit e26a1f807b
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 6 additions and 4 deletions

View File

@ -105,11 +105,13 @@ void JoypadLinux::run_joypad_thread() {
udev *_udev = udev_new(); udev *_udev = udev_new();
if (!_udev) { if (!_udev) {
use_udev = false; use_udev = false;
ERR_FAIL_MSG("Failed getting an udev context, falling back to parsing /dev/input."); ERR_PRINT("Failed getting an udev context, falling back to parsing /dev/input.");
monitor_joypads();
} else {
enumerate_joypads(_udev);
monitor_joypads(_udev);
udev_unref(_udev);
} }
enumerate_joypads(_udev);
monitor_joypads(_udev);
udev_unref(_udev);
} else { } else {
monitor_joypads(); monitor_joypads();
} }