Fix potential crash during sprite creation
This commit is contained in:
parent
c421c49916
commit
dcc4068e46
|
@ -39,6 +39,8 @@ local function cache_groups(group, groups)
|
||||||
|
|
||||||
for _, item in ipairs(items) do
|
for _, item in ipairs(items) do
|
||||||
local def = reg_items[item]
|
local def = reg_items[item]
|
||||||
|
|
||||||
|
if def then
|
||||||
local tiles = def.tiles or def.tile_images
|
local tiles = def.tiles or def.tile_images
|
||||||
local texture = true_str(def.inventory_image) and def.inventory_image --or tiles[1]
|
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
|
if c == lim then break end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if c > 1 then
|
||||||
sprite = sprite:gsub("WxH", px .. "x" .. px * c)
|
sprite = sprite:gsub("WxH", px .. "x" .. px * c)
|
||||||
|
|
||||||
i3.groups[group].sprite = sprite
|
i3.groups[group].sprite = sprite
|
||||||
i3.groups[group].count = c
|
i3.groups[group].count = c
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function get_item_usages(item, recipe, added)
|
local function get_item_usages(item, recipe, added)
|
||||||
if is_group(item) then
|
if is_group(item) then
|
||||||
|
|
Ŝarĝante…
Reference in New Issue