Neither fixed it. I had to patch control.lua to do an entity validity check for each item found in the loop at l.117:
local entitiesToDamage = surface.find_entities(area)
for i = 1, #entitiesToDamage, 1 do
local ent = entitiesToDamage[i]
if ent.valid
and (global.exemptDamageItems[ent.type] == nil)
and (ent.prototype.max_health > 0) then
ent.damage(global.structureDamage, game.forces.neutral, "tiberium")
end
end
I have some weird stuff going on in my game (e.g. power poles get damaged even though they're supposed to be immune).