Changed as<bool>() to return true for any non-null value (closes #1005)

This commit is contained in:
Benoit Blanchon
2019-08-28 13:05:07 +02:00
parent fcbec6eb6d
commit ed18e77655
3 changed files with 21 additions and 14 deletions

View File

@ -40,11 +40,10 @@ inline bool VariantData::asBoolean() const {
return _content.asInteger != 0;
case VALUE_IS_FLOAT:
return _content.asFloat != 0;
case VALUE_IS_LINKED_STRING:
case VALUE_IS_OWNED_STRING:
return strcmp("true", _content.asString) == 0;
default:
case VALUE_IS_NULL:
return false;
default:
return true;
}
}