Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/miloyip/rapidjson.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStilesCrisis <johnstiles@John-Stiles-iMac.local>2017-02-28 09:53:59 +0300
committerStilesCrisis <johnstiles@John-Stiles-iMac.local>2017-02-28 09:53:59 +0300
commitfa84cd18f48294dc94f659c3f7a272b26ea5b1b5 (patch)
tree5b36c0d2f7460361bfdc8ad5a5f2bacfc47c29cb /include/rapidjson/prettywriter.h
parent2e9b7b1ae6ef162b5aa0c04f2b4444be4c8b72cb (diff)
Add matching fix for PrettyWriter
PrettyWriter EndObject will now also assert if called when a key is missing its matching value.
Diffstat (limited to 'include/rapidjson/prettywriter.h')
-rw-r--r--include/rapidjson/prettywriter.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/rapidjson/prettywriter.h b/include/rapidjson/prettywriter.h
index d663208a..b68b687d 100644
--- a/include/rapidjson/prettywriter.h
+++ b/include/rapidjson/prettywriter.h
@@ -136,8 +136,10 @@ public:
bool EndObject(SizeType memberCount = 0) {
(void)memberCount;
- RAPIDJSON_ASSERT(Base::level_stack_.GetSize() >= sizeof(typename Base::Level));
- RAPIDJSON_ASSERT(!Base::level_stack_.template Top<typename Base::Level>()->inArray);
+ RAPIDJSON_ASSERT(Base::level_stack_.GetSize() >= sizeof(typename Base::Level)); // not inside an Object
+ RAPIDJSON_ASSERT(!Base::level_stack_.template Top<typename Base::Level>()->inArray); // currently inside an Array, not Object
+ RAPIDJSON_ASSERT(0 == Base::level_stack_.template Top<typename Base::Level>()->valueCount % 2); // Object has a Key without a Value
+
bool empty = Base::level_stack_.template Pop<typename Base::Level>(1)->valueCount == 0;
if (!empty) {