Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Generals/Code/GameEngine/Source/Common/Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,8 @@ Bool RecorderClass::playbackFile(AsciiString filename)
}
}

m_mode = RECORDERMODETYPE_PLAYBACK;
// TheSuperHackers @bugfix bobtista Don't set playback mode until after file opens successfully
// to prevent crash if playback is updated while m_file is NULL

ReplayHeader header;
header.forPlayback = TRUE;
Expand All @@ -1207,6 +1208,8 @@ Bool RecorderClass::playbackFile(AsciiString filename)
return FALSE;
}

m_mode = RECORDERMODETYPE_PLAYBACK;

#ifdef DEBUG_CRASHING
Bool versionStringDiff = header.versionString != TheVersion->getUnicodeVersion();
Bool versionTimeStringDiff = header.versionTimeString != TheVersion->getUnicodeBuildTime();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,20 @@ void reallyLoadReplay(void)
AsciiString asciiFilename;
asciiFilename.translate(filename);

// TheSuperHackers @bugfix bobtista Check if file still exists before attempting playback
// to prevent crash when file is deleted during version mismatch prompt
RecorderClass::ReplayHeader header;
ReplayGameInfo info;
const MapMetaData *mapData;

if(!readReplayMapInfo(asciiFilename, header, info, mapData))
{
UnicodeString title = TheGameText->FETCH_OR_SUBSTITUTE("GUI:ReplayFileNotFoundTitle", L"REPLAY NOT FOUND");
UnicodeString body = TheGameText->FETCH_OR_SUBSTITUTE("GUI:ReplayFileNotFound", L"This replay cannot be loaded because the file no longer exists on this device.");
MessageBoxOk(title, body, NULL);
return;
}

TheRecorder->playbackFile(asciiFilename);

if(parentReplayMenu != NULL)
Expand Down
5 changes: 4 additions & 1 deletion GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,8 @@ Bool RecorderClass::playbackFile(AsciiString filename)
}
}

m_mode = RECORDERMODETYPE_PLAYBACK;
// TheSuperHackers @bugfix bobtista Don't set playback mode until after file opens successfully
// to prevent crash if playback is updated while m_file is NULL

ReplayHeader header;
header.forPlayback = TRUE;
Expand All @@ -1210,6 +1211,8 @@ Bool RecorderClass::playbackFile(AsciiString filename)
return FALSE;
}

m_mode = RECORDERMODETYPE_PLAYBACK;

#ifdef DEBUG_CRASHING
Bool versionStringDiff = header.versionString != TheVersion->getUnicodeVersion();
Bool versionTimeStringDiff = header.versionTimeString != TheVersion->getUnicodeBuildTime();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,20 @@ void reallyLoadReplay(void)
AsciiString asciiFilename;
asciiFilename.translate(filename);

// TheSuperHackers @bugfix bobtista Check if file still exists before attempting playback
// to prevent crash when file is deleted during version mismatch prompt
RecorderClass::ReplayHeader header;
ReplayGameInfo info;
const MapMetaData *mapData;

if(!readReplayMapInfo(asciiFilename, header, info, mapData))
{
UnicodeString title = TheGameText->FETCH_OR_SUBSTITUTE("GUI:ReplayFileNotFoundTitle", L"REPLAY NOT FOUND");
UnicodeString body = TheGameText->FETCH_OR_SUBSTITUTE("GUI:ReplayFileNotFound", L"This replay cannot be loaded because the file no longer exists on this device.");
MessageBoxOk(title, body, NULL);
return;
}

TheRecorder->playbackFile(asciiFilename);

if(parentReplayMenu != NULL)
Expand Down
Loading