device: don't crash on Linux if no devices are found

Fixes #634
Closes #635
This commit is contained in:
Rishabh Tewari 2019-04-28 13:03:17 -05:00 committed by rdb
parent 00b3fbdb1a
commit bfb50ab7ff

View File

@ -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);