diff --git a/libraries/controllers/src/controllers/ScriptingInterface.cpp b/libraries/controllers/src/controllers/ScriptingInterface.cpp index e49248e8f0..a62172a730 100644 --- a/libraries/controllers/src/controllers/ScriptingInterface.cpp +++ b/libraries/controllers/src/controllers/ScriptingInterface.cpp @@ -204,25 +204,24 @@ namespace controller { } void ScriptingInterface::updateMaps() { + QVariantMap newHardware; auto userInputMapper = DependencyManager::get(); auto devices = userInputMapper->getDevices(); - QSet foundDevices; for (const auto& deviceMapping : devices) { auto deviceID = deviceMapping.first; if (deviceID != userInputMapper->getStandardDeviceID()) { auto device = deviceMapping.second; auto deviceName = QString(device->getName()).remove(SANITIZE_NAME_EXPRESSION); qCDebug(controllers) << "Device" << deviceMapping.first << ":" << deviceName; - foundDevices.insert(device->getName()); - if (_hardware.contains(deviceName)) { + if (newHardware.contains(deviceName)) { continue; } // Expose the IDs to JS - _hardware.insert(deviceName, createDeviceMap(device)); + newHardware.insert(deviceName, createDeviceMap(device)); } - } + _hardware = newHardware; }