shanemadden / factorio-deadlock-beltboxes-loaders

Other
8 stars 16 forks source link

Crash when attempting to stack an item with no subgroup #35

Open Mernom opened 1 year ago

Mernom commented 1 year ago

Error log:

Failed to load mods: __deadlock-beltboxes-loaders__/prototypes/create_stack.lua:19: attempt to index field '?' (a nil value)
stack traceback:
    __deadlock-beltboxes-loaders__/prototypes/create_stack.lua:19: in function 'get_group'
    __deadlock-beltboxes-loaders__/prototypes/create_stack.lua:79: in function 'create_stacked_item'
    __deadlock-beltboxes-loaders__/prototypes/public.lua:194: in function 'add_stack'
    __personal__/data-final-fixes.lua:104: in main chunk

Code to reproduce:

if deadlock_stacking then
  local new_item = table.deepcopy (data.raw.item.wood)
  new_item.name = "test-item"
  new_item.subgroup = nil
  data:extend { new_item }
  deadlock.add_stack ( "test-item" )
end

Suggestion: add a fallback to the ... [data.raw[item_type][item].subgroup].group ... part.