summaryrefslogtreecommitdiffstats
path: root/Utilities/cmjsoncpp
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-01-13 20:08:32 (GMT)
committerBrad King <brad.king@kitware.com>2015-01-15 16:39:03 (GMT)
commit50032bc847a79dc209e6e1ae4dd77a2ec2d52be9 (patch)
tree3d3006d41a1ea99c003933b49668b737553ff21a /Utilities/cmjsoncpp
parentad94b0521eb3a0e05c120b510d047dd18b27c9df (diff)
downloadCMake-50032bc847a79dc209e6e1ae4dd77a2ec2d52be9.zip
CMake-50032bc847a79dc209e6e1ae4dd77a2ec2d52be9.tar.gz
CMake-50032bc847a79dc209e6e1ae4dd77a2ec2d52be9.tar.bz2
jsoncpp: Add missing assert before strcmp in json_value.cpp
The strcmp function does not allow NULL pointers, so add an assert to tell Clang scan-build that the code does not expect a NULL pointer.
Diffstat (limited to 'Utilities/cmjsoncpp')
-rw-r--r--Utilities/cmjsoncpp/src/lib_json/json_value.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/Utilities/cmjsoncpp/src/lib_json/json_value.cpp b/Utilities/cmjsoncpp/src/lib_json/json_value.cpp
index 8f46d3b..478afe1 100644
--- a/Utilities/cmjsoncpp/src/lib_json/json_value.cpp
+++ b/Utilities/cmjsoncpp/src/lib_json/json_value.cpp
@@ -195,14 +195,18 @@ Value::CZString& Value::CZString::operator=(CZString other) {
}
bool Value::CZString::operator<(const CZString& other) const {
- if (cstr_)
+ if (cstr_) {
+ assert(other.cstr_);
return strcmp(cstr_, other.cstr_) < 0;
+ }
return index_ < other.index_;
}
bool Value::CZString::operator==(const CZString& other) const {
- if (cstr_)
+ if (cstr_) {
+ assert(other.cstr_);
return strcmp(cstr_, other.cstr_) == 0;
+ }
return index_ == other.index_;
}