1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-05 01:50:25 +01:00

Check return value of get_surface_pos before indexing it

- Solves #126
This commit is contained in:
LeMagnesium 2015-07-14 14:52:39 +02:00
parent 24b398aa10
commit 1fd331615a

View File

@ -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