From a0a52e50a2bd5fff4870f7c68576383add2e6092 Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Sat, 6 Jan 2018 20:53:58 -0800 Subject: [PATCH] Make initialization options parsing less crashy if null is passed instead of undefined/nothing. See issue #247. --- src/serializers/json.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/serializers/json.h b/src/serializers/json.h index b6e5b005..6707322a 100644 --- a/src/serializers/json.h +++ b/src/serializers/json.h @@ -40,6 +40,9 @@ class JsonReader : public Reader { } void DoMember(const char* name, std::function fn) override { + if (m_->GetType() != rapidjson::Type::kObjectType) + return; // FIXME: signal an error that object was not deserialized correctly? + auto it = m_->FindMember(name); if (it != m_->MemberEnd()) { JsonReader sub(&it->value);