diff --git a/worldedit/serialization.lua b/worldedit/serialization.lua index e796fc1..ddc59cd 100644 --- a/worldedit/serialization.lua +++ b/worldedit/serialization.lua @@ -196,7 +196,7 @@ end -- @return The number of nodes. function worldedit.allocate(origin_pos, value) local nodes = load_schematic(value) - if not nodes then return nil end + if not nodes or #nodes == 0 then return nil end return worldedit.allocate_with_nodes(origin_pos, nodes) end diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua index 61aafc1..cc169ee 100644 --- a/worldedit_commands/init.lua +++ b/worldedit_commands/init.lua @@ -1163,9 +1163,15 @@ minetest.register_chatcommand("/allocate", { return elseif version > worldedit.LATEST_SERIALIZATION_VERSION then worldedit.player_notify(name, "File was created with newer version of WorldEdit!") + return end local nodepos1, nodepos2, count = worldedit.allocate(pos, value) + if not nodepos1 then + worldedit.player_notify(name, "Schematic empty, nothing allocated") + return + end + worldedit.pos1[name] = nodepos1 worldedit.mark_pos1(name) worldedit.pos2[name] = nodepos2