sbrl / Minetest-WorldEditAdditions

Extra tools and commands to extend WorldEdit for Minetest
https://worldeditadditions.mooncarrot.space/
Mozilla Public License 2.0
16 stars 3 forks source link

multi many multi crash #41

Closed VorTechnix closed 3 years ago

VorTechnix commented 3 years ago

Steps to reproduce: Run in chat //multi <some commands> //many 2 //multi <some more commands>

The command I ran: //multi //fp set1 -63 19 -20 //scube z z 3 //many 2 //multi //shift z 1 //shift y 1

Error thrown on crash:

AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback on_chat_message(): ...ions\worldeditadditions_commands/commands/meta/multi.lua:45: bad argument #1 to 'sub' (string expected, got nil)
stack traceback:
    [C]: in function 'sub'
    ...ions\worldeditadditions_commands/commands/meta/multi.lua:45: in function 'func'
    ...ions\worldeditadditions_commands/commands/meta/multi.lua:62: in function 'func'
    ...\Media\minetest-5.3.0-win64\bin\..\builtin\game\chat.lua:69: in function <...\Media\minetest-5.3.0-win64\bin\..\builtin\game\chat.lua:48>
    ...ia\minetest-5.3.0-win64\bin\..\builtin\game\register.lua:429: in function <...ia\minetest-5.3.0-win64\bin\..\builtin\game\register.lua:413>
sbrl commented 3 years ago

Ah, nice one! I've added some additional checks to avoid that from happening in the future.

You're nesting //multi calls there, which won't do what you expect. The top-most //multi command will split on /, which splits the //many from the subsequent //multi, which in turn separates it from the //shift.