fix a crash in the replay browser
This commit is contained in:
@@ -76,14 +76,22 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
|||||||
currentReplay = value;
|
currentReplay = value;
|
||||||
if (currentReplay != null)
|
if (currentReplay != null)
|
||||||
{
|
{
|
||||||
var summary = new ReplaySummary(currentReplay);
|
try
|
||||||
var mapStub = MapStubFromSummary(summary);
|
{
|
||||||
|
var summary = new ReplaySummary(currentReplay);
|
||||||
|
var mapStub = MapStubFromSummary(summary);
|
||||||
|
|
||||||
widget.GetWidget<LabelWidget>("DURATION").GetText =
|
widget.GetWidget<LabelWidget>("DURATION").GetText =
|
||||||
() => WidgetUtils.FormatTime(summary.Duration * 3 /* todo: 3:1 ratio isnt always true. */);
|
() => WidgetUtils.FormatTime(summary.Duration * 3 /* todo: 3:1 ratio isnt always true. */);
|
||||||
widget.GetWidget<MapPreviewWidget>("MAP_PREVIEW").Map = () => mapStub;
|
widget.GetWidget<MapPreviewWidget>("MAP_PREVIEW").Map = () => mapStub;
|
||||||
widget.GetWidget<LabelWidget>("MAP_TITLE").GetText =
|
widget.GetWidget<LabelWidget>("MAP_TITLE").GetText =
|
||||||
() => mapStub != null ? mapStub.Title : "(Unknown Map)";
|
() => mapStub != null ? mapStub.Title : "(Unknown Map)";
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
Log.Write("debug", "Exception while parsing replay: {0}", e.ToString());
|
||||||
|
currentReplay = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ Background@REPLAYBROWSER_BG:
|
|||||||
Text:Choose Replay
|
Text:Choose Replay
|
||||||
Align:Center
|
Align:Center
|
||||||
Bold:True
|
Bold:True
|
||||||
ListBox@REPLAY_LIST:
|
ScrollPanel@REPLAY_LIST:
|
||||||
Id:REPLAY_LIST
|
Id:REPLAY_LIST
|
||||||
X:20
|
X:20
|
||||||
Y:50
|
Y:50
|
||||||
|
|||||||
Reference in New Issue
Block a user