- clear pspAsArray at the beginning of a save/load operation, not at the end.

If done at the end it may leave behind some stale data if saving or loading fails for some reason.
This commit is contained in:
Christoph Oelckers 2021-08-30 14:31:03 +02:00
parent e13426ec6e
commit bad57f6a5f
2 changed files with 3 additions and 3 deletions

View file

@ -1051,8 +1051,8 @@ FSerializer &Serialize(FSerializer &arc, const char *key, double &value, double
auto val = arc.r->FindKey(key);
if (val != nullptr)
{
assert(val->IsDouble());
if (val->IsDouble())
assert(val->IsNumber());
if (val->IsNumber())
{
value = val->GetDouble();
}

View file

@ -301,7 +301,6 @@ void postSerializePanelSprites(FSerializer& arc)
}
arc.EndArray();
}
pspAsArray.Clear();
}
//---------------------------------------------------------------------------
@ -1222,6 +1221,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, TRACK& w, TRACK* d
void GameInterface::SerializeGameState(FSerializer& arc)
{
pspAsArray.Clear();
Saveable_Init();
if (arc.BeginObject("state"))