Fix potential crash during sprite creation

This commit is contained in:
Jean-Patrick Guerrero 2022-06-28 01:03:41 +02:00
parent c421c49916
commit dcc4068e46
1 changed files with 19 additions and 14 deletions

View File

@ -39,6 +39,8 @@ local function cache_groups(group, groups)
for _, item in ipairs(items) do
local def = reg_items[item]
if def then
local tiles = def.tiles or def.tile_images
local texture = true_str(def.inventory_image) and def.inventory_image --or tiles[1]
@ -54,12 +56,15 @@ local function cache_groups(group, groups)
if c == lim then break end
end
end
end
if c > 1 then
sprite = sprite:gsub("WxH", px .. "x" .. px * c)
i3.groups[group].sprite = sprite
i3.groups[group].count = c
end
end
local function get_item_usages(item, recipe, added)
if is_group(item) then