Fix addMetadata iterator comparisons
Recently, we noticed our a number of our redfish requests were giving
unexpected Bad Request errors and we pinpointed it to a change in
82b286fb77833c70bd670f3b428e49f6d9416d06 [1]. This fixes the logic so we
properly add metadata when it's there instead of skipping over it
[1] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/80063
Change-Id: I9a50afd4da1acaa4fa2388e5e22bdac327776509
Signed-off-by: James Athappilly <jamesatha@gmail.com>
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 027e75d..7b22377 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -207,12 +207,12 @@
return;
}
const auto nameIt = sensorObject.find("Name");
- if (nameIt != sensorObject.end())
+ if (nameIt == sensorObject.end())
{
return;
}
const auto idIt = sensorObject.find("@odata.id");
- if (idIt != sensorObject.end())
+ if (idIt == sensorObject.end())
{
return;
}