1
0
Fork 0

Add saftey measures in case the variables are nil and can't perform arithmetic functions

This commit is contained in:
Eliy21 2024-01-21 10:22:53 +00:00
parent 2d2b64006b
commit 242209e5f0
1 changed files with 6 additions and 6 deletions

View File

@ -259,12 +259,12 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc
if collisionbox then
-- Create rays from random points in the collision box
local x1 = collisionbox[1]
local y1 = collisionbox[2]
local z1 = collisionbox[3]
local x2 = collisionbox[4]
local y2 = collisionbox[5]
local z2 = collisionbox[6]
local x1 = collisionbox[1] or 0.0
local y1 = collisionbox[2] or 0.0
local z1 = collisionbox[3] or 0.0
local x2 = collisionbox[4] or 0.0
local y2 = collisionbox[5] or 0.0
local z2 = collisionbox[6] or 0.0
local x_len = math.abs(x2 - x1)
local y_len = math.abs(y2 - y1)
local z_len = math.abs(z2 - z1)