Fixed crash when loading savegame

This commit is contained in:
smallmodel 2023-08-16 19:13:52 +02:00
parent ce1b3aaee9
commit 467802c466
No known key found for this signature in database
GPG key ID: A96F163ED4891440
2 changed files with 5 additions and 14 deletions

View file

@ -659,13 +659,8 @@ void GameScript::ArchiveCodePos( Archiver& arc, unsigned char **codePos )
int pos = 0;
str filename;
if( !arc.Saving() )
{
pos = *codePos - m_ProgBuffer;
if( pos >= 0 && pos < m_ProgLength )
{
filename = Filename();
}
if( arc.Saving() ) {
GetCodePos(*codePos, filename, pos);
}
arc.ArchiveInteger( &pos );
@ -673,10 +668,7 @@ void GameScript::ArchiveCodePos( Archiver& arc, unsigned char **codePos )
if( arc.Loading() )
{
if( Filename() == filename )
{
*codePos = m_ProgBuffer + pos;
}
SetCodePos(*codePos, filename, pos);
}
}