mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2025-10-15 23:25:39 +02:00
Check empty command parameters strictly
This commit is contained in:
@@ -51,6 +51,7 @@ local function chatcommand_handler(cmd_name, name, param)
|
||||
end
|
||||
end
|
||||
|
||||
param = param:trim()
|
||||
local parsed = {def.parse(param)}
|
||||
local success = table.remove(parsed, 1)
|
||||
if not success then
|
||||
@@ -116,8 +117,9 @@ function worldedit.register_command(name, def)
|
||||
def.require_pos = def.require_pos or 0
|
||||
assert(def.require_pos >= 0 and def.require_pos < 3)
|
||||
if def.params == "" and not def.parse then
|
||||
-- FIXME: shouldn't this check for param to be empty?
|
||||
def.parse = function(param) return true end
|
||||
def.parse = function(param)
|
||||
return param == ""
|
||||
end
|
||||
else
|
||||
assert(def.parse)
|
||||
end
|
||||
|
@@ -34,7 +34,7 @@ local description_cache = nil
|
||||
|
||||
-- normalizes node "description" `nodename`, returning a string (or nil)
|
||||
worldedit.normalize_nodename = function(nodename)
|
||||
nodename = nodename:gsub("^%s*(.-)%s*$", "%1") -- strip spaces
|
||||
nodename = nodename:trim()
|
||||
if nodename == "" then
|
||||
return nil
|
||||
end
|
||||
|
Reference in New Issue
Block a user