0
0
Fork 0

Fix commandblock crash if opening empty one

This commit is contained in:
Wuzzy 2019-03-16 03:09:51 +01:00
parent 8ee1521f14
commit 8cfcbea9cb
1 changed files with 4 additions and 1 deletions

View File

@ -145,6 +145,9 @@ local on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local commands = meta:get_string("commands") local commands = meta:get_string("commands")
if not commands then
commands = ""
end
local commander = meta:get_string("commander") local commander = meta:get_string("commander")
local commanderstr local commanderstr
if commander == "" or commander == nil then if commander == "" or commander == nil then
@ -263,7 +266,7 @@ minetest.register_node("mesecons_commandblock:commandblock_on", {
minetest.register_on_player_receive_fields(function(player, formname, fields) minetest.register_on_player_receive_fields(function(player, formname, fields)
if string.sub(formname, 1, 13) == "commandblock_" then if string.sub(formname, 1, 13) == "commandblock_" then
if not fields.submit and not fields.key_enter and not fields.doc then if (not fields.submit and not fields.key_enter and not fields.doc) or (not fields.commands) then
return return
end end
local privs = minetest.get_player_privs(player:get_player_name()) local privs = minetest.get_player_privs(player:get_player_name())