check if palette.CurrentQueue is null to avoid a crash

fixes #5624
This commit is contained in:
Matthias Mailänder
2014-07-02 12:18:47 +02:00
parent 0d61a1d19a
commit 30edee01c2

View File

@@ -66,7 +66,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
powerLabel.IsVisible = () => power != 0; powerLabel.IsVisible = () => power != 0;
var lowpower = pm.PowerState != PowerState.Normal; var lowpower = pm.PowerState != PowerState.Normal;
var time = palette.CurrentQueue.GetBuildTime(actor) var time = palette.CurrentQueue == null ? 0 : palette.CurrentQueue.GetBuildTime(actor)
* (lowpower ? palette.CurrentQueue.Info.LowPowerSlowdown : 1); * (lowpower ? palette.CurrentQueue.Info.LowPowerSlowdown : 1);
var timeString = "T: {0}".F(WidgetUtils.FormatTime(time)); var timeString = "T: {0}".F(WidgetUtils.FormatTime(time));
timeLabel.GetText = () => timeString; timeLabel.GetText = () => timeString;