From a259dae29f538533a538980cfa9de61dc276b832 Mon Sep 17 00:00:00 2001 From: Steel_Blue Date: Fri, 24 Jul 2026 20:50:47 -0400 Subject: [PATCH 1/2] Utility function ignores bad unitDefIDs --- LuaRules/Utilities/unitTypeChecker.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/LuaRules/Utilities/unitTypeChecker.lua b/LuaRules/Utilities/unitTypeChecker.lua index 8925f2339a..64a41feefe 100644 --- a/LuaRules/Utilities/unitTypeChecker.lua +++ b/LuaRules/Utilities/unitTypeChecker.lua @@ -60,7 +60,11 @@ local isComm = {} function Spring.Utilities.isComm(unitDefID) if not isComm[unitDefID] then local ud = UnitDefs[unitDefID] - isComm[unitDefID] = (ud.customParams.dynamic_comm or ud.customParams.commtype) and 1 or 0 + if ud ~= nil then + isComm[unitDefID] = (ud.customParams.dynamic_comm or ud.customParams.commtype) and 1 or 0 + else + isComm[unitDefID] = 0 + end end return isComm[unitDefID] == 1 end From 485485b0e7e462fe7e50978112c96126149d3303 Mon Sep 17 00:00:00 2001 From: Steel_Blue Date: Sat, 25 Jul 2026 10:16:05 -0400 Subject: [PATCH 2/2] removed if statement --- LuaRules/Utilities/unitTypeChecker.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/LuaRules/Utilities/unitTypeChecker.lua b/LuaRules/Utilities/unitTypeChecker.lua index 64a41feefe..f9d33e26bb 100644 --- a/LuaRules/Utilities/unitTypeChecker.lua +++ b/LuaRules/Utilities/unitTypeChecker.lua @@ -60,11 +60,7 @@ local isComm = {} function Spring.Utilities.isComm(unitDefID) if not isComm[unitDefID] then local ud = UnitDefs[unitDefID] - if ud ~= nil then - isComm[unitDefID] = (ud.customParams.dynamic_comm or ud.customParams.commtype) and 1 or 0 - else - isComm[unitDefID] = 0 - end + isComm[unitDefID] = ud and ud.customParams and (ud.customParams.dynamic_comm or ud.customParams.commtype) and 1 or 0 end return isComm[unitDefID] == 1 end