From: Gunnar Beutner Date: Thu, 30 Jul 2015 18:01:08 +0000 (+0200) Subject: Fix: Operator - should not work with "" and numbers X-Git-Tag: v2.4.0~461 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9d098482dddab38189a7def22827b8d43a30d653;p=icinga2 Fix: Operator - should not work with "" and numbers fixes #9793 --- diff --git a/lib/base/value-operators.cpp b/lib/base/value-operators.cpp index 7c25188c7..f53bbda6a 100644 --- a/lib/base/value-operators.cpp +++ b/lib/base/value-operators.cpp @@ -275,7 +275,7 @@ Value icinga::operator+(int lhs, const Value& rhs) Value icinga::operator-(const Value& lhs, const Value& rhs) { - if ((lhs.IsNumber() || lhs.IsEmpty()) && (rhs.IsNumber() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty())) + if ((lhs.IsNumber() || lhs.IsEmpty()) && !lhs.IsString() && (rhs.IsNumber() || rhs.IsEmpty()) && !rhs.IsString() && !(lhs.IsEmpty() && rhs.IsEmpty())) return static_cast(lhs) - static_cast(rhs); else if ((lhs.IsObjectType() || lhs.IsEmpty()) && (rhs.IsObjectType() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty())) { if (lhs.IsEmpty())