- 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 committed by drfrag
parent 32f0bbfe03
commit e4bf84b015

View file

@ -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();
}
//==========================================================================