aboutsummaryrefslogtreecommitdiff
path: root/trainhud.lua
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2016-10-05 15:27:16 +0200
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2016-10-05 15:27:16 +0200
commit307b4048ac620f6e3368976b1575f2ac800edc70 (patch)
tree791c661dca7d9e82e299af42a2b508d2a1619f16 /trainhud.lua
parentcacd0da4314759fd41cd3318afca4a9c99bba78d (diff)
downloadadvtrains-307b4048ac620f6e3368976b1575f2ac800edc70.tar.gz
advtrains-307b4048ac620f6e3368976b1575f2ac800edc70.tar.bz2
advtrains-307b4048ac620f6e3368976b1575f2ac800edc70.zip
Fixed crash problem
Diffstat (limited to 'trainhud.lua')
-rw-r--r--trainhud.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/trainhud.lua b/trainhud.lua
index 601b28f..81b9e94 100644
--- a/trainhud.lua
+++ b/trainhud.lua
@@ -8,6 +8,9 @@ end)
function advtrains.set_trainhud(name, text)
local hud = advtrains.hud[name]
local player=minetest.get_player_by_name(name)
+ if not player then
+ return
+ end
if not hud then
hud = {}
advtrains.hud[name] = hud
@@ -53,4 +56,4 @@ function advtrains.hud_train_format(train, flip)
elseif vel>0 then
return firstLine.."\n"..secondLine.."\nPress up to accelerate, down to decelerate, sneak to stop."
end
-end \ No newline at end of file
+end