Added assertion
Documented existing assertions in EndObject Added new assertion in EndObject to catch error condition where objects are ended with a key but no matching value.
This commit is contained in:
parent
595b114216
commit
2e9b7b1ae6
@ -221,8 +221,9 @@ public:
|
|||||||
|
|
||||||
bool EndObject(SizeType memberCount = 0) {
|
bool EndObject(SizeType memberCount = 0) {
|
||||||
(void)memberCount;
|
(void)memberCount;
|
||||||
RAPIDJSON_ASSERT(level_stack_.GetSize() >= sizeof(Level));
|
RAPIDJSON_ASSERT(level_stack_.GetSize() >= sizeof(Level)); // not inside an Object
|
||||||
RAPIDJSON_ASSERT(!level_stack_.template Top<Level>()->inArray);
|
RAPIDJSON_ASSERT(!level_stack_.template Top<Level>()->inArray); // currently inside an Array, not Object
|
||||||
|
RAPIDJSON_ASSERT(0 == level_stack_.template Top<Level>()->valueCount % 2); // Object has a Key without a Value
|
||||||
level_stack_.template Pop<Level>(1);
|
level_stack_.template Pop<Level>(1);
|
||||||
return EndValue(WriteEndObject());
|
return EndValue(WriteEndObject());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user