PerformScan: Return early from pruneRecordExposes()
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ie5a128c4d3abcd817710b1116e3c10908aa1de8f
diff --git a/src/PerformScan.cpp b/src/PerformScan.cpp
index a3c240a..a9c32a6 100644
--- a/src/PerformScan.cpp
+++ b/src/PerformScan.cpp
@@ -247,19 +247,21 @@
static void pruneRecordExposes(nlohmann::json& record)
{
auto findExposes = record.find("Exposes");
- if (findExposes != record.end())
+ if (findExposes == record.end())
{
- auto copy = nlohmann::json::array();
- for (auto& expose : *findExposes)
- {
- if (expose.is_null())
- {
- continue;
- }
- copy.emplace_back(expose);
- }
- *findExposes = copy;
+ return;
}
+
+ auto copy = nlohmann::json::array();
+ for (auto& expose : *findExposes)
+ {
+ if (expose.is_null())
+ {
+ continue;
+ }
+ copy.emplace_back(expose);
+ }
+ *findExposes = copy;
}
void PerformScan::run()