summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorSokomine <wegwerf@anarres.dyndns.org>2015-03-03 05:47:30 +0100
committerSokomine <wegwerf@anarres.dyndns.org>2015-03-03 05:47:30 +0100
commitfa1efe2a290f3549d7f2ef61fe62a4f41e5caa2f (patch)
tree57e837c8b0aa72230e66504e55fe2b768fe67540 /init.lua
parent2c9fe6cb869b1d7e753e734717b44b9efb4dce84 (diff)
fixed a crash with markers beeing placed in one line
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index a21c913..cd69a0d 100644
--- a/init.lua
+++ b/init.lua
@@ -336,6 +336,9 @@ markers.get_marker_formspec = function(player, pos, error_msg)
if(not( ((n-i) == opposite )
or not(markers.positions[ name ][ n-i ] )
+ or not( coords ) or not( coords[1]) or not( coords[2])
+ or not(markers.positions[ name ] )
+ or not(markers.positions[ name ][ n-i ] )
or ( markers.positions[ name ][ n-i ].x == coords[ 1 ].x
and markers.positions[ name ][ n-i ].z == coords[ 2 ].z )
or ( markers.positions[ name ][ n-i ].x == coords[ 2 ].x
@@ -349,6 +352,9 @@ markers.get_marker_formspec = function(player, pos, error_msg)
-- save data
meta:set_string( 'coords', minetest.serialize( coords ) );
end
+ if( not( coords ) or #coords < 2 or not( coords[1] ) or not( coords[2] )) then
+ return formspec_info.."Error: The last 4 markers\nyou placed do not form\na rectangle.]";
+ end
-- the coordinates are set; we may present an input form now