From bfb50ab7ff85b409b93908e14897a3abd2a4a032 Mon Sep 17 00:00:00 2001 From: Rishabh Tewari Date: Sun, 28 Apr 2019 13:03:17 -0500 Subject: [PATCH] device: don't crash on Linux if no devices are found Fixes #634 Closes #635 --- panda/src/device/linuxInputDeviceManager.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/panda/src/device/linuxInputDeviceManager.cxx b/panda/src/device/linuxInputDeviceManager.cxx index 8eed3e1cc3..7b9b9fdf6f 100644 --- a/panda/src/device/linuxInputDeviceManager.cxx +++ b/panda/src/device/linuxInputDeviceManager.cxx @@ -61,6 +61,9 @@ LinuxInputDeviceManager() { // We'll want to sort the devices by index, since the order may be // meaningful (eg. for the Xbox wireless receiver). + if (indices.empty()) { + return; + } std::sort(indices.begin(), indices.end()); _evdev_devices.resize(indices.back() + 1, nullptr);