crash correction

master
Alexsandro Percy 2020-06-11 13:39:58 -03:00
parent 199a7f9a76
commit 3b78b070ed
2 changed files with 7 additions and 2 deletions

View File

@ -37,6 +37,9 @@ function helicopter.check_node_below(obj)
end
function helicopter.heli_control(self, dtime, touching_ground, liquid_below, vel_before)
if self.driver_name == nil then
return
end
local driver = minetest.get_player_by_name(self.driver_name)
if not driver then
-- there is no driver (eg. because driver left)

View File

@ -435,8 +435,10 @@ minetest.register_entity("helicopter:heli", {
-- driver clicked the object => driver gets off the vehicle
self.driver_name = nil
-- sound and animation
minetest.sound_stop(self.sound_handle)
self.sound_handle = nil
if self.sound_handle then
minetest.sound_stop(self.sound_handle)
self.sound_handle = nil
end
self.object:set_animation_frame_speed(0)
-- detach the player
clicker:set_detach()