Utils: Declare mathChars and nextItemIdx where they're used
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I33cce402bb610114df0444fe1bed28662ac80594
diff --git a/src/Utils.cpp b/src/Utils.cpp
index c19ec12..dd13113 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -247,10 +247,7 @@
continue;
}
- constexpr const std::array<char, 5> mathChars = {'+', '-', '%', '*',
- '/'};
size_t start = find.begin() - strPtr->begin();
- size_t nextItemIdx = start + templateName.size() + 1;
// check for additional operations
if (!start && find.end() == strPtr->end())
@@ -258,6 +255,11 @@
std::visit([&](auto&& val) { keyPair.value() = val; }, propValue);
return ret;
}
+
+ constexpr const std::array<char, 5> mathChars = {'+', '-', '%', '*',
+ '/'};
+ size_t nextItemIdx = start + templateName.size() + 1;
+
if (nextItemIdx > strPtr->size() ||
std::find(mathChars.begin(), mathChars.end(),
strPtr->at(nextItemIdx)) == mathChars.end())