PerformScan: Eliminate duplicate type check in run()
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I83f4b7f48f24129caff233a8eb8bb3e797a09b91
diff --git a/src/PerformScan.cpp b/src/PerformScan.cpp
index f36ab16..befd210 100644
--- a/src/PerformScan.cpp
+++ b/src/PerformScan.cpp
@@ -479,23 +479,14 @@
continue;
}
- if (keyPair.value().type() !=
- nlohmann::json::value_t::string &&
- keyPair.value().type() !=
- nlohmann::json::value_t::array)
- {
- std::cerr << "Value is invalid type "
- << keyPair.key() << "\n";
- continue;
- }
-
std::vector<std::string> matches;
if (keyPair.value().type() ==
nlohmann::json::value_t::string)
{
matches.emplace_back(keyPair.value());
}
- else
+ else if (keyPair.value().type() ==
+ nlohmann::json::value_t::array)
{
for (const auto& value : keyPair.value())
{
@@ -509,6 +500,12 @@
matches.emplace_back(value);
}
}
+ else
+ {
+ std::cerr << "Value is invalid type "
+ << keyPair.key() << "\n";
+ continue;
+ }
std::set<std::string> foundMatches;
for (auto& [configId, config] :