diff options
author | ShadowNinja <shadowninja@minetest.net> | 2013-11-18 21:16:06 -0500 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2013-11-18 21:16:06 -0500 |
commit | db1d87c00865972a82312d57235f86cf0352d260 (patch) | |
tree | eb48c81c2a02f4ed89caa7b3c6752ae846e32e70 | |
parent | 0d0215200cd3f353e3240ae275c2ef35fc86077e (diff) |
Fix /find_areas invalid regular expression crash
-rw-r--r-- | chatcommands.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/chatcommands.lua b/chatcommands.lua index e951142..00a31b0 100644 --- a/chatcommands.lua +++ b/chatcommands.lua @@ -172,6 +172,16 @@ minetest.register_chatcommand("find_areas", { return end + -- Check expression for validity + local function testRegExp() + ("Test [1]: Player (0,0,0) (0,0,0)"):find(param) + end + if not pcall(testRegExp) then + minetest.chat_send_player(name, + "Invalid regular expression.") + return + end + local found = false for id, area in pairs(areas.areas) do if areas:isAreaOwner(id, name) and |