summaryrefslogtreecommitdiff
path: root/Utilities/cmjsoncpp/src/lib_json/json_value.cpp
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-01-13 15:08:32 -0500
committerBrad King <brad.king@kitware.com>2015-01-15 11:39:03 -0500
commit50032bc847a79dc209e6e1ae4dd77a2ec2d52be9 (patch)
tree3d3006d41a1ea99c003933b49668b737553ff21a /Utilities/cmjsoncpp/src/lib_json/json_value.cpp
parentad94b0521eb3a0e05c120b510d047dd18b27c9df (diff)
downloadcmake-50032bc847a79dc209e6e1ae4dd77a2ec2d52be9.tar.gz
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/src/lib_json/json_value.cpp')
-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 8f46d3b3f1..478afe102b 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_;
}