From a0946979e7beb8171c4d3ff850a8ebc5e34d3b30 Mon Sep 17 00:00:00 2001 From: Jason Naylor Date: Fri, 6 Feb 2026 10:46:21 -0800 Subject: [PATCH] Add robust handling in string table lookup (LT-22392) * Bad strings are coming from Crowdin (an id was translated) * This fixes the crash but the root issue still needs to be addressed or localized strings with the bad id won't work --- Src/Common/FwUtils/StringTable.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Src/Common/FwUtils/StringTable.cs b/Src/Common/FwUtils/StringTable.cs index d0fe674267..48bb443e82 100644 --- a/Src/Common/FwUtils/StringTable.cs +++ b/Src/Common/FwUtils/StringTable.cs @@ -177,9 +177,10 @@ private void MergeCustomGroups(XmlNode parentNode, XmlNodeList customGroupNodeLi // 1. Import new strings, or override extant strings with custom strings. foreach (XmlNode customStringNode in customGroupNode.SelectNodes("string")) { - string customId = XmlUtils.GetMandatoryAttributeValue(customStringNode, "id"); - string customTxt = GetTxtAtributeValue(customStringNode); - XmlNode srcMatchingStringNode = srcMatchingGroupNode.SelectSingleNode("string[@id='" + customId + "']"); + var customId = XmlUtils.GetMandatoryAttributeValue(customStringNode, "id"); + var customTxt = GetTxtAtributeValue(customStringNode); + // escape customId for use in XPath query, in case it contains characters that are not valid in XPath queries. + var srcMatchingStringNode = srcMatchingGroupNode.SelectSingleNode("string[@id='" + XmlUtils.MakeSafeXml(customId) + "']"); if (srcMatchingStringNode == null) { // Import the new string into the extant group.