From f8717585024e6baaa664bb484598fe4093f4a8cf Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 18 Mar 2014 15:48:50 +0100 Subject: [PATCH] Fix the !in operator. Refs #5789 --- lib/config/aexpression.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/config/aexpression.cpp b/lib/config/aexpression.cpp index 0521c17c3..637b46d0e 100644 --- a/lib/config/aexpression.cpp +++ b/lib/config/aexpression.cpp @@ -94,7 +94,19 @@ Value AExpression::Evaluate(const Dictionary::Ptr& locals) const return found; case AENotIn: - return left != right; + if (!right.IsObjectType()) + BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid right side argument for 'in' operator: " + JsonSerialize(right))); + + arr = right; + found = false; + BOOST_FOREACH(const Value& value, arr) { + if (value == left) { + found = true; + break; + } + } + + return !found; case AELogicalAnd: return (long)left && (long)right; case AELogicalOr: