From 7f7809fe70510e65ac3bbf2b77b288b4dff7f17b Mon Sep 17 00:00:00 2001 From: LipkeGu Date: Sun, 28 Apr 2019 14:03:11 +0200 Subject: [PATCH] Use TryGet instead of Get and assign a default Fallback Color This Fixes a crash in Situations when custom mods are used and reset OpenRA to its initial state. --- OpenRA.Game/Game.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 1c2eda76a5..aa1e0500af 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -465,8 +465,8 @@ namespace OpenRA Log.Write("nat", e.ToString()); } - chatMessageColor = ChromeMetrics.Get("ChatMessageColor"); - systemMessageColor = ChromeMetrics.Get("SystemMessageColor"); + ChromeMetrics.TryGet("ChatMessageColor", out chatMessageColor); + ChromeMetrics.TryGet("SystemMessageColor", out systemMessageColor); ModData.LoadScreen.StartGame(args); } @@ -527,8 +527,8 @@ namespace OpenRA // Note: These delayed actions should only be used by widgets or disposing objects // - things that depend on a particular world should be queuing them on the world actor. static volatile ActionQueue delayedActions = new ActionQueue(); - static Color systemMessageColor; - static Color chatMessageColor; + static Color systemMessageColor = Color.White; + static Color chatMessageColor = Color.White; public static void RunAfterTick(Action a) { delayedActions.Add(a, RunTime); } public static void RunAfterDelay(int delayMilliseconds, Action a) { delayedActions.Add(a, RunTime + delayMilliseconds); }