Skip to content

Commit

Permalink
Fix the regression tests as reported on #1142
Browse files Browse the repository at this point in the history
  • Loading branch information
zimmerle committed May 5, 2016
1 parent 3062ff2 commit d0e0002
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/operators/contains.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ bool Contains::evaluate(Transaction *transaction, const std::string &input) {
std::string p = MacroExpansion::expand(param, transaction);
bool contains = input.find(p) != std::string::npos;

if (contains) {
if (contains && transaction) {
transaction->m_matched.push_back(p);
}

Expand Down
2 changes: 1 addition & 1 deletion src/operators/pm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ bool Pm::evaluate(Transaction *transaction, const std::string &input) {
const char *match = NULL;

rc = acmp_process_quick(&pt, &match, input.c_str(), input.length());
if (rc == 1) {
if (rc == 1 && transaction) {
transaction->m_matched.push_back(std::string(match));
}

Expand Down
8 changes: 7 additions & 1 deletion src/operators/rx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ namespace operators {
bool Rx::evaluate(Transaction *transaction, const std::string& input) {
SMatch match;

if (m_param.empty()) {
return true;
}

if (regex_search(input, &match, *m_re) && match.size() >= 1) {
transaction->m_matched.push_back(match.match);
if (transaction) {
transaction->m_matched.push_back(match.match);
}
return true;
}

Expand Down

0 comments on commit d0e0002

Please sign in to comment.