From e9f6e606e279afec5bd7cd0a64f2359503d676a5 Mon Sep 17 00:00:00 2001 From: Rui Date: Tue, 31 May 2016 23:37:32 +0900 Subject: [PATCH] Fix mailbox error (#52) `tiles` is not a required field. Indexing it may fail. Fix #51 --- mailbox.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mailbox.lua b/mailbox.lua index 1985eea..f538ab6 100644 --- a/mailbox.lua +++ b/mailbox.lua @@ -8,7 +8,12 @@ local function img_col(stack) if def.inventory_image ~= "" then return def.inventory_image:match("(.*)%.png")..".png" end - return def.tiles[1]:match("(.*)%.png")..".png" + + if def.tiles and def.tiles[1] then + return def.tiles[1]:match("(.*)%.png")..".png" + end + + return "" end function mailbox:formspec(pos, owner, num)