PerformScan: Concurrent modification of container needs visibility
We're removing an item from foundDevices while iterating over
foundDevices. Improve the visibility of what's going on, especially
given the odd loop header (missing the 'post' action of the for-loop)
and the presence of many `continue` keywords.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I491b69369598e2454812c1945baacab5aeeeebb9
diff --git a/src/PerformScan.cpp b/src/PerformScan.cpp
index 7ff1198..85dedf4 100644
--- a/src/PerformScan.cpp
+++ b/src/PerformScan.cpp
@@ -340,7 +340,11 @@
// keep user changes
_systemConfiguration[recordName] = *fromLastJson;
_missingConfigurations.erase(recordName);
+
+ // We've processed the device, remove it and advance the
+ // iterator
itr = foundDevices.erase(itr);
+
if (hasTemplateName)
{
auto nameIt = fromLastJson->find("Name");