diff --git a/pkg/base/lib_map.lua b/pkg/base/lib_map.lua index 26fdda7..88d6bf8 100644 --- a/pkg/base/lib_map.lua +++ b/pkg/base/lib_map.lua @@ -438,7 +438,9 @@ end function map_block_pick(x,y,z) local xlen,ylen,zlen xlen,ylen,zlen = common.map_get_dims() + if x < 0 or x >= xlen then return end if y < 0 or y >= ylen then return end + if z < 0 or z >= zlen then return end local t = map_pillar_raw_get(x,z) local c = t[y+1] diff --git a/pkg/base/obj_player.lua b/pkg/base/obj_player.lua index 013977d..9057fe7 100644 --- a/pkg/base/obj_player.lua +++ b/pkg/base/obj_player.lua @@ -714,10 +714,12 @@ function new_player(settings) if this.tool == TOOL_BLOCK and this.blx3 and this.alive then local ct,cr,cg,cb ct,cr,cg,cb = map_block_pick(this.blx3, this.bly3, this.blz3) - this.blk_color = {cr,cg,cb} - common.net_send(nil, common.net_pack("BBBBB", - 0x18, 0x00, - this.blk_color[1],this.blk_color[2],this.blk_color[3])) + if ct ~= nil then + this.blk_color = {cr,cg,cb} + common.net_send(nil, common.net_pack("BBBBB", + 0x18, 0x00, + this.blk_color[1],this.blk_color[2],this.blk_color[3])) + end this.ev_rmb = false elseif this.tool == TOOL_SPADE and this.blx2 and this.alive then if (not this.t_newspade2) then