From e4bb13ea07349daa09a7a2ecdd07754a39538fe7 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Thu, 26 Jan 2023 10:13:10 +0100 Subject: [PATCH] Throw an ArgumentException when trying to translate null keys --- OpenRA.Game/Translation.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenRA.Game/Translation.cs b/OpenRA.Game/Translation.cs index 60e9fecd5d..6a628a6262 100644 --- a/OpenRA.Game/Translation.cs +++ b/OpenRA.Game/Translation.cs @@ -88,6 +88,9 @@ namespace OpenRA public bool TryGetString(string key, out string value, IDictionary arguments = null) { + if (string.IsNullOrEmpty(key)) + throw new ArgumentException("A translation key must not be null or empty.", nameof(key)); + try { if (!HasMessage(key))