From 1fd331615af8548005b0ab9742d4f27d418448bd Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Tue, 14 Jul 2015 14:52:39 +0200 Subject: [PATCH] Check return value of get_surface_pos before indexing it - Solves #126 --- mods/worldedge/init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mods/worldedge/init.lua b/mods/worldedge/init.lua index 7a7bf9bd..61430f63 100755 --- a/mods/worldedge/init.lua +++ b/mods/worldedge/init.lua @@ -62,10 +62,14 @@ minetest.register_globalstep(function(dtime) if pos.z >= edge then newpos = {x = pos.x, y = 10, z = -newedge} - newpos.y = get_surface_pos(newpos).y+1 -- /MFF (Mg|19/05//15) + if get_surface_pos(newpos) then + newpos.y = get_surface_pos(newpos).y+1 -- /MFF (Mg|19/05//15) + end -- /MFF (Mg|14/07/15) elseif pos.z <= -edge then newpos = {x = pos.x, y = 10, z = newedge} - newpos.y = get_surface_pos(newpos).y+1 -- /MFF (Mg|19/05/15) + if get_surface_pos(newpos) then + newpos.y = get_surface_pos(newpos).y+1 -- /MFF (Mg|19/05/15) + end -- /MFF (Mg|14/07/15) end -- Teleport the player