mirror of https://github.com/Icinga/icinga2.git
Fix: Operator + is inconsistent when used with empty and non-empty strings
fixes #9806
This commit is contained in:
parent
60f86d01fe
commit
276f491762
|
@ -228,9 +228,9 @@ Value icinga::operator+(const String& lhs, const Value& rhs)
|
||||||
|
|
||||||
Value icinga::operator+(const Value& 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<double>(lhs) + static_cast<double>(rhs);
|
return static_cast<double>(lhs) + static_cast<double>(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<String>(lhs) + static_cast<String>(rhs);
|
return static_cast<String>(lhs) + static_cast<String>(rhs);
|
||||||
else if ((lhs.IsNumber() || lhs.IsEmpty()) && (rhs.IsNumber() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
|
else if ((lhs.IsNumber() || lhs.IsEmpty()) && (rhs.IsNumber() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
|
||||||
return static_cast<double>(lhs) + static_cast<double>(rhs);
|
return static_cast<double>(lhs) + static_cast<double>(rhs);
|
||||||
|
|
Loading…
Reference in New Issue