Fix crash if save does not exist

This commit is contained in:
Ted John 2021-01-29 21:10:31 +00:00
parent 129d85fa57
commit 477677775f
1 changed files with 5 additions and 5 deletions

View File

@ -498,15 +498,15 @@ static std::string LegacyScriptWrite(const TitleSequence& seq)
switch (command.Type) switch (command.Type)
{ {
case TitleScript::Load: case TitleScript::Load:
if (command.SaveIndex == 0xFF) if (command.SaveIndex < seq.Saves.size())
{
sb.Append("LOAD <No save file>");
}
else
{ {
sb.Append("LOAD "); sb.Append("LOAD ");
sb.Append(seq.Saves[command.SaveIndex].c_str()); sb.Append(seq.Saves[command.SaveIndex].c_str());
} }
else
{
sb.Append("LOAD <No save file>");
}
break; break;
case TitleScript::LoadSc: case TitleScript::LoadSc:
if (command.Scenario[0] == '\0') if (command.Scenario[0] == '\0')