fix a crash in the replay browser

This commit is contained in:
Chris Forbes
2010-12-19 17:46:11 +13:00
parent 2fad6f3bf1
commit f3d0e4b8ed
2 changed files with 16 additions and 8 deletions

View File

@@ -76,14 +76,22 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
currentReplay = value;
if (currentReplay != null)
{
var summary = new ReplaySummary(currentReplay);
var mapStub = MapStubFromSummary(summary);
try
{
var summary = new ReplaySummary(currentReplay);
var mapStub = MapStubFromSummary(summary);
widget.GetWidget<LabelWidget>("DURATION").GetText =
() => WidgetUtils.FormatTime(summary.Duration * 3 /* todo: 3:1 ratio isnt always true. */);
widget.GetWidget<MapPreviewWidget>("MAP_PREVIEW").Map = () => mapStub;
widget.GetWidget<LabelWidget>("MAP_TITLE").GetText =
() => mapStub != null ? mapStub.Title : "(Unknown Map)";
widget.GetWidget<LabelWidget>("DURATION").GetText =
() => WidgetUtils.FormatTime(summary.Duration * 3 /* todo: 3:1 ratio isnt always true. */);
widget.GetWidget<MapPreviewWidget>("MAP_PREVIEW").Map = () => mapStub;
widget.GetWidget<LabelWidget>("MAP_TITLE").GetText =
() => mapStub != null ? mapStub.Title : "(Unknown Map)";
}
catch(Exception e)
{
Log.Write("debug", "Exception while parsing replay: {0}", e.ToString());
currentReplay = null;
}
}
}
}

View File

@@ -15,7 +15,7 @@ Background@REPLAYBROWSER_BG:
Text:Choose Replay
Align:Center
Bold:True
ListBox@REPLAY_LIST:
ScrollPanel@REPLAY_LIST:
Id:REPLAY_LIST
X:20
Y:50