fire(): Return before declaring def, if stack is nil
This commit is contained in:
parent
40fa0fd4ca
commit
b23f5fa2de
7
api.lua
7
api.lua
@ -52,12 +52,13 @@ local function hide_scope(player)
|
||||
end
|
||||
|
||||
local function fire(stack, player)
|
||||
local def = gunslinger.get_def(stack:get_name())
|
||||
|
||||
if not def or not stack then
|
||||
-- Workaround to prevent function from executing if stack is nil
|
||||
if not stack then
|
||||
return
|
||||
end
|
||||
|
||||
local def = gunslinger.get_def(stack:get_name())
|
||||
|
||||
-- Play gunshot sound
|
||||
play_sound(def.fire_sound or "gunslinger_fire1")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user