From a36ce260ac7f24b5868e75314a652c7033335ace Mon Sep 17 00:00:00 2001 From: Thulinma Date: Fri, 20 Jul 2012 17:48:40 +0200 Subject: [PATCH] Fixed JSON bool evaluations. --- lib/json.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/json.cpp b/lib/json.cpp index 14dd789f..4f60747e 100644 --- a/lib/json.cpp +++ b/lib/json.cpp @@ -286,9 +286,9 @@ JSON::Value::operator std::string(){ /// Automatic conversion to bool. /// Returns true if there is anything meaningful stored into this value. JSON::Value::operator bool(){ - if (myType == STRING){return strVal == "";} - if (myType == INTEGER){return intVal == 0;} - if (myType == BOOL){return intVal == 0;} + if (myType == STRING){return strVal != "";} + if (myType == INTEGER){return intVal != 0;} + if (myType == BOOL){return intVal != 0;} if (myType == OBJECT){return size() > 0;} if (myType == ARRAY){return size() > 0;} if (myType == EMPTY){return false;}