Fix spectator crash if replay does not define FinalGameTick.

This commit is contained in:
Paul Chote
2019-01-04 17:56:22 +00:00
committed by abcdefg30
parent f929087d15
commit 01f5c67036

View File

@@ -66,8 +66,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (timerTooltip != null)
{
var connection = orderManager.Connection as ReplayConnection;
if (connection != null && connection.TickCount != 0)
if (connection != null && connection.FinalGameTick != 0)
timerTooltip.GetTooltipText = () => "{0}% complete".F(world.WorldTick * 100 / connection.FinalGameTick);
else if (connection != null && connection.TickCount != 0)
timerTooltip.GetTooltipText = () => "{0}% complete".F(orderManager.NetFrameNumber * 100 / connection.TickCount);
else
timerTooltip.GetTooltipText = null;
}