diff --git a/LuaRules/Utilities/unitTypeChecker.lua b/LuaRules/Utilities/unitTypeChecker.lua index 8925f2339a..f9d33e26bb 100644 --- a/LuaRules/Utilities/unitTypeChecker.lua +++ b/LuaRules/Utilities/unitTypeChecker.lua @@ -60,7 +60,7 @@ 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 + 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