mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 16:32:14 -06:00
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.
This commit is contained in:
@@ -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_;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user