Fix: Operator - should not work with "" and numbers

fixes #9793
This commit is contained in:
Gunnar Beutner 2015-07-30 20:01:08 +02:00
parent df6deb1b3e
commit 9d098482dd
1 changed files with 1 additions and 1 deletions

View File

@ -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<double>(lhs) - static_cast<double>(rhs);
else if ((lhs.IsObjectType<Array>() || lhs.IsEmpty()) && (rhs.IsObjectType<Array>() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty())) {
if (lhs.IsEmpty())