Skip to content

Commit

Permalink
Fix mailbox error (minetest-mods#52)
Browse files Browse the repository at this point in the history
`tiles` is not a required field. Indexing it may fail.

Fix minetest-mods#51
  • Loading branch information
Rui authored and sofar committed May 31, 2016
1 parent de2deee commit e9f6e60
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mailbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e9f6e60

Please sign in to comment.