From 276f491762cdc3b311d6e955af35ab6d76576b2f Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 1 Aug 2015 04:35:50 +0200 Subject: [PATCH] Fix: Operator + is inconsistent when used with empty and non-empty strings fixes #9806 --- lib/base/value-operators.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/base/value-operators.cpp b/lib/base/value-operators.cpp index f53bbda6a..46d50a5e2 100644 --- a/lib/base/value-operators.cpp +++ b/lib/base/value-operators.cpp @@ -228,9 +228,9 @@ Value icinga::operator+(const String& lhs, const Value& rhs) Value icinga::operator+(const Value& lhs, const Value& rhs) { - if ((lhs.IsEmpty() || lhs.IsNumber()) && (rhs.IsEmpty() || rhs.IsNumber()) && !(lhs.IsEmpty() && rhs.IsEmpty())) + if ((lhs.IsEmpty() || lhs.IsNumber()) && !lhs.IsString() && (rhs.IsEmpty() || rhs.IsNumber()) && !rhs.IsString() && !(lhs.IsEmpty() && rhs.IsEmpty())) return static_cast(lhs) + static_cast(rhs); - if ((lhs.IsString() || lhs.IsEmpty() || lhs.IsNumber()) && (rhs.IsString() || rhs.IsEmpty() || rhs.IsNumber()) && !(lhs.IsEmpty() && rhs.IsEmpty())) + if ((lhs.IsString() || lhs.IsEmpty() || lhs.IsNumber()) && (rhs.IsString() || rhs.IsEmpty() || rhs.IsNumber())) return static_cast(lhs) + static_cast(rhs); else if ((lhs.IsNumber() || lhs.IsEmpty()) && (rhs.IsNumber() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty())) return static_cast(lhs) + static_cast(rhs);