Skip to content

Commit a259dae

Browse files
committed
Utility function ignores bad unitDefIDs
1 parent d1f9c8c commit a259dae

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

LuaRules/Utilities/unitTypeChecker.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ local isComm = {}
6060
function Spring.Utilities.isComm(unitDefID)
6161
if not isComm[unitDefID] then
6262
local ud = UnitDefs[unitDefID]
63-
isComm[unitDefID] = (ud.customParams.dynamic_comm or ud.customParams.commtype) and 1 or 0
63+
if ud ~= nil then
64+
isComm[unitDefID] = (ud.customParams.dynamic_comm or ud.customParams.commtype) and 1 or 0
65+
else
66+
isComm[unitDefID] = 0
67+
end
6468
end
6569
return isComm[unitDefID] == 1
6670
end

0 commit comments

Comments
 (0)