- treat non-existent arrays in the savegame as zero length.

This commit is contained in:
Christoph Oelckers 2018-12-29 01:17:59 +01:00
parent cad43e431c
commit 496dd4ee68

View file

@ -920,9 +920,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();
}
//==========================================================================