mirror of
https://github.com/overte-org/overte.git
synced 2025-08-13 05:30:18 +02:00
fix crash in Controller when asking for device name out of bounds
This commit is contained in:
parent
275cdf9d8f
commit
6549e47dbc
2 changed files with 9 additions and 1 deletions
|
@ -32,6 +32,14 @@ UserInputMapper::DeviceProxy::Pointer UserInputMapper::getDeviceProxy(const Inpu
|
|||
}
|
||||
}
|
||||
|
||||
QString UserInputMapper::getDeviceName(uint16 deviceID) {
|
||||
if (_registeredDevices.find(deviceID) != _registeredDevices.end()) {
|
||||
return _registeredDevices[deviceID]->_name;
|
||||
}
|
||||
return QString("unknown");
|
||||
}
|
||||
|
||||
|
||||
void UserInputMapper::resetAllDeviceBindings() {
|
||||
for (auto device : _registeredDevices) {
|
||||
device.second->resetDeviceBindings();
|
||||
|
|
|
@ -123,7 +123,7 @@ public:
|
|||
uint16 getFreeDeviceID() { return _nextFreeDeviceID++; }
|
||||
bool registerDevice(uint16 deviceID, const DeviceProxy::Pointer& device);
|
||||
DeviceProxy::Pointer getDeviceProxy(const Input& input);
|
||||
QString getDeviceName(uint16 deviceID) { return _registeredDevices[deviceID]->_name; }
|
||||
QString getDeviceName(uint16 deviceID);
|
||||
QVector<InputPair> getAvailableInputs(uint16 deviceID) { return _registeredDevices[deviceID]->getAvailabeInputs(); }
|
||||
void resetAllDeviceBindings();
|
||||
void resetDevice(uint16 deviceID);
|
||||
|
|
Loading…
Reference in a new issue