mirror of
https://github.com/minetest-mods/areas.git
synced 2024-12-25 02:00:40 +01:00
Fix crash when using /area_pos# with invalid arguments
This commit is contained in:
parent
0c20a1b616
commit
5b4cbe122f
6
pos.lua
6
pos.lua
@ -41,7 +41,7 @@ minetest.register_chatcommand("area_pos1", {
|
|||||||
.." location or the one specified",
|
.." location or the one specified",
|
||||||
privs = {},
|
privs = {},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos = {}
|
local pos = nil
|
||||||
local found, _, x, y, z = param:find(
|
local found, _, x, y, z = param:find(
|
||||||
"^(-?%d+)[%s%,]+(-?%d+)[%s%,]+(-?%d+)$")
|
"^(-?%d+)[%s%,]+(-?%d+)[%s%,]+(-?%d+)$")
|
||||||
if found then
|
if found then
|
||||||
@ -58,6 +58,7 @@ minetest.register_chatcommand("area_pos1", {
|
|||||||
else
|
else
|
||||||
minetest.chat_send_player(name,
|
minetest.chat_send_player(name,
|
||||||
"Invalid usage, see /help area_pos1")
|
"Invalid usage, see /help area_pos1")
|
||||||
|
return
|
||||||
end
|
end
|
||||||
pos = vector.round(pos)
|
pos = vector.round(pos)
|
||||||
areas:setPos1(name, pos)
|
areas:setPos1(name, pos)
|
||||||
@ -73,7 +74,7 @@ minetest.register_chatcommand("area_pos2", {
|
|||||||
.." location or the one specified",
|
.." location or the one specified",
|
||||||
privs = {},
|
privs = {},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos = {}
|
local pos = nil
|
||||||
local found, _, x, y, z = param:find(
|
local found, _, x, y, z = param:find(
|
||||||
"^(-?%d+)[%s%,]+(-?%d+)[%s%,]+(-?%d+)$")
|
"^(-?%d+)[%s%,]+(-?%d+)[%s%,]+(-?%d+)$")
|
||||||
if found then
|
if found then
|
||||||
@ -90,6 +91,7 @@ minetest.register_chatcommand("area_pos2", {
|
|||||||
else
|
else
|
||||||
minetest.chat_send_player(name,
|
minetest.chat_send_player(name,
|
||||||
"Invalid usage, see /help area_pos2")
|
"Invalid usage, see /help area_pos2")
|
||||||
|
return
|
||||||
end
|
end
|
||||||
pos = vector.round(pos)
|
pos = vector.round(pos)
|
||||||
areas:setPos2(name, pos)
|
areas:setPos2(name, pos)
|
||||||
|
Loading…
Reference in New Issue
Block a user