Guard against nil values

This commit is contained in:
Raffson 2024-02-24 22:05:13 +01:00
parent d3d4acd806
commit b737f4e00c
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99

View File

@ -574,10 +574,12 @@ function onWpnEvent(event)
end
local player = event.initiator
targetName = event.target:getTypeName()
local targetName = event.target:getTypeName()
local impactPoint = event.target:getPosition().p
env.info(weapon.." hit "..targetName)
debugMsg(weapon.." hit "..targetName)
if weapon and targetName then
env.info(weapon.." hit "..targetName)
debugMsg(weapon.." hit "..targetName)
end
--env.info('Impact point was at: X: ' .. impactPoint.x .. ' Y: ' .. impactPoint.y .. ' Z: ' .. impactPoint.z)
if clusterWeaps[weapon] then
local ordnance = event.weapon