aboutsummaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorFredrik Roubert <roubert@google.com>2014-09-03 16:56:06 +0200
committerFredrik Roubert <roubert@google.com>2014-09-03 17:49:46 +0200
commitb9d1324966707ba1f725c1386e98626fa0c8bc29 (patch)
tree755146d8c2d4485e9a92a91025589ab81f978e32 /cpp/src
parentc8a40e02062894963c9d79e8d3a6b9dfbdcb3e20 (diff)
downloadsrc-b9d1324966707ba1f725c1386e98626fa0c8bc29.tar.gz
Prepare for RapidJSON FindMember() API change.
Currently, ConstMemberIterator is implemented as a pointer and FindMember() returns NULL to signal not found. But ConstMemberIterator is going to be changed to a non-pointer type and the return value for not found will then be changed to MemberEnd(). To make this code work for both cases, the return value is first compared to a newly created empty ConstMemberIterator (ie. NULL, when ConstMemberIterator is implemented as a pointer) and then compared to MemberEnd().
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/util/json.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/cpp/src/util/json.cc b/cpp/src/util/json.cc
index 730479c..46d830a 100644
--- a/cpp/src/util/json.cc
+++ b/cpp/src/util/json.cc
@@ -68,7 +68,8 @@ class Json::JsonImpl {
assert(value != NULL);
Value::ConstMemberIterator member = value_->FindMember(key.c_str());
- if (member == NULL || !member->value.IsString()) {
+ if (member == Value::ConstMemberIterator() ||
+ member == value_->MemberEnd() || !member->value.IsString()) {
return false;
}