diff --git a/src/serializer.cpp b/src/serializer.cpp index ac08beaa6..8b8b68f8a 100644 --- a/src/serializer.cpp +++ b/src/serializer.cpp @@ -927,9 +927,10 @@ unsigned FSerializer::GetSize(const char *group) { if (isWriting()) return -1; // we do not know this when writing. - const rapidjson::Value &val = r->mDoc[group]; - if (!val.IsArray()) return -1; - return val.Size(); + const rapidjson::Value *val = r->FindKey(group); + if (!val) return 0; + if (!val->IsArray()) return -1; + return val->Size(); } //==========================================================================