EntityManager: Continue the loop if the entity is present

Avoid nesting further logic by inverting the presence test.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I679943181aa5c3ad8620c4ffc8ab5b984ca06b8f
diff --git a/src/EntityManager.cpp b/src/EntityManager.cpp
index 08797ac..5ec5cfa 100644
--- a/src/EntityManager.cpp
+++ b/src/EntityManager.cpp
@@ -884,22 +884,24 @@
             bool powerOff = !isPowerOn();
             for (const auto& item : lastJson.items())
             {
-                if (!systemConfiguration.contains(item.key()))
+                if (systemConfiguration.contains(item.key()))
                 {
-                    bool requirePowerOn = deviceRequiresPowerOn(item.value());
-                    if (powerOff && requirePowerOn)
-                    {
-                        // power not on yet, don't know if it's there or not
-                        continue;
-                    }
-                    if (!powerOff && scannedPowerOff && requirePowerOn)
-                    {
-                        // already logged it when power was off
-                        continue;
-                    }
-
-                    logDeviceRemoved(item.value());
+                    continue;
                 }
+
+                bool requirePowerOn = deviceRequiresPowerOn(item.value());
+                if (powerOff && requirePowerOn)
+                {
+                    // power not on yet, don't know if it's there or not
+                    continue;
+                }
+                if (!powerOff && scannedPowerOff && requirePowerOn)
+                {
+                    // already logged it when power was off
+                    continue;
+                }
+
+                logDeviceRemoved(item.value());
             }
             scannedPowerOff = true;
             if (!powerOff)