From 5b4cbe122feb0159f4c5e851e4b4006cd3c1b750 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Tue, 29 Oct 2013 12:38:12 -0400 Subject: [PATCH] Fix crash when using /area_pos# with invalid arguments --- pos.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pos.lua b/pos.lua index 80ff5b5..9f08371 100644 --- a/pos.lua +++ b/pos.lua @@ -41,7 +41,7 @@ minetest.register_chatcommand("area_pos1", { .." location or the one specified", privs = {}, func = function(name, param) - local pos = {} + local pos = nil local found, _, x, y, z = param:find( "^(-?%d+)[%s%,]+(-?%d+)[%s%,]+(-?%d+)$") if found then @@ -58,6 +58,7 @@ minetest.register_chatcommand("area_pos1", { else minetest.chat_send_player(name, "Invalid usage, see /help area_pos1") + return end pos = vector.round(pos) areas:setPos1(name, pos) @@ -73,7 +74,7 @@ minetest.register_chatcommand("area_pos2", { .." location or the one specified", privs = {}, func = function(name, param) - local pos = {} + local pos = nil local found, _, x, y, z = param:find( "^(-?%d+)[%s%,]+(-?%d+)[%s%,]+(-?%d+)$") if found then @@ -90,6 +91,7 @@ minetest.register_chatcommand("area_pos2", { else minetest.chat_send_player(name, "Invalid usage, see /help area_pos2") + return end pos = vector.round(pos) areas:setPos2(name, pos)