Fix some 'Failed to get GUI object by name' errors

Fixes #8297
This commit is contained in:
Vantha 2025-08-20 11:14:18 +02:00
parent e22c5bd05e
commit 4dace890cf

View file

@ -77,8 +77,8 @@ function setupUnitPanel(guiName, unitEntStates, playerState)
"rowLength": rowLength, "rowLength": rowLength,
"numberOfItems": numberOfItems, "numberOfItems": numberOfItems,
// depending on the XML, some of the GUI objects may be undefined // depending on the XML, some of the GUI objects may be undefined
"button": Engine.GetGUIObjectByName("unit" + guiName + "Button[" + i + "]"), "button": Engine.TryGetGUIObjectByName("unit" + guiName + "Button[" + i + "]"),
"icon": Engine.GetGUIObjectByName("unit" + guiName + "Icon[" + i + "]"), "icon": Engine.TryGetGUIObjectByName("unit" + guiName + "Icon[" + i + "]"),
"guiSelection": Engine.TryGetGUIObjectByName("unit" + guiName + "Selection[" + i + "]"), "guiSelection": Engine.TryGetGUIObjectByName("unit" + guiName + "Selection[" + i + "]"),
"countDisplay": Engine.TryGetGUIObjectByName("unit" + guiName + "Count[" + i + "]") "countDisplay": Engine.TryGetGUIObjectByName("unit" + guiName + "Count[" + i + "]")
}; };