Adds method resolveFirstCopy to collections

Using the copy whenever it is necessary to avoid memory leak.
This commit is contained in:
Felipe Zimmerle
2016-07-08 10:22:37 -03:00
parent 6e4226ee4d
commit 833089eb70
8 changed files with 131 additions and 7 deletions

View File

@@ -109,14 +109,14 @@ bool SetVar::evaluate(Rule *rule, Transaction *transm_parser_payload) {
}
try {
std::string *resolvedValue =
transm_parser_payload->m_collections.resolveFirst(
std::string resolvedValue =
transm_parser_payload->m_collections.resolveFirstCopy(
m_collectionName,
m_variableNameExpanded);
if (resolvedValue == NULL) {
if (resolvedValue.empty()) {
value = 0;
} else {
value = stoi(*resolvedValue);
value = stoi(resolvedValue);
}
} catch (...) {
value = 0;