Merge pull request #12038 from pchote/fix-readfailure-crash
Don't crash if a replay can't be read.
This commit is contained in:
@@ -77,7 +77,13 @@ namespace OpenRA.Mods.Common.LoadScreens
|
|||||||
// Load a replay directly
|
// Load a replay directly
|
||||||
if (!string.IsNullOrEmpty(Launch.Replay))
|
if (!string.IsNullOrEmpty(Launch.Replay))
|
||||||
{
|
{
|
||||||
var replayMeta = ReplayMetadata.Read(Launch.Replay);
|
ReplayMetadata replayMeta = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
replayMeta = ReplayMetadata.Read(Launch.Replay);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
if (ReplayUtils.PromptConfirmReplayCompatibility(replayMeta, Game.LoadShellMap))
|
if (ReplayUtils.PromptConfirmReplayCompatibility(replayMeta, Game.LoadShellMap))
|
||||||
Game.JoinReplay(Launch.Replay);
|
Game.JoinReplay(Launch.Replay);
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
onCancel = DoNothing;
|
onCancel = DoNothing;
|
||||||
|
|
||||||
if (replayMeta == null)
|
if (replayMeta == null)
|
||||||
return IncompatibleReplayDialog("outdated engine", null, onCancel);
|
{
|
||||||
|
ConfirmationDialogs.ButtonPrompt("Incompatible Replay", "Replay metadata could not be read.", onCancel: onCancel);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var version = replayMeta.GameInfo.Version;
|
var version = replayMeta.GameInfo.Version;
|
||||||
if (version == null)
|
if (version == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user