Handle empty strings in Json::Value::empty()

This commit is contained in:
Tom Ritchford
2015-06-18 15:31:20 -04:00
committed by Nik Bougalis
parent e4f585b7fe
commit a5a9242f4e
2 changed files with 33 additions and 4 deletions

View File

@@ -825,10 +825,15 @@ Value::size () const
bool
Value::empty () const
{
if ( isNull () || isArray () || isObject () )
return size () == 0u;
else
return false;
if (isNull ())
return true;
if (isString ()) {
auto s = asCString();
return !(s && strlen(s));
}
return (isArray () || isObject ()) && ! size ();
}