Jump to content

[Server Crash] - Crash when item spoils on cursor with rot in inventory


rezecib

Recommended Posts

Bug Submission:

Category: Server Crash
Issue Title: Crash when item spoils on cursor with rot in inventory
Issue Description: If you have rot in your inventory, and an item spoils on your cursor, it will crash the server. It appears this is because it gives you the rot before it adjusts the stack size of the rot to match the item that spoiled, so if it merges with your stack of rot, then it tries to change the stack size of an inventoryitem_replica that doesn't have a classified anymore.
Steps to Reproduce:
Have rot in your inventory.

Pick up an item about to spoil on your cursor.

Wait for it to spoil.

 

The stack trace:

...ta/data/scripts/components/inventoryitem_replica.lua:139: attempt to index field 'classified' (a nil value)
LUA ERROR stack traceback:
        C:/Program Files (x86)/Steam/steamapps/common/Don't Starve Together Beta/data/scripts/components/inventoryitem_replica.lua(139,1) in function 'SetPickupPos'
        C:/Program Files (x86)/Steam/steamapps/common/Don't Starve Together Beta/data/scripts/components/stackable.lua(6,1) in function '?'
        C:/Program Files (x86)/Steam/steamapps/common/Don't Starve Together Beta/data/scripts/class.lua(30,1)
        C:/Program Files (x86)/Steam/steamapps/common/Don't Starve Together Beta/data/scripts/components/stackable.lua(55,1) in function 'SetStackSize'
        C:/Program Files (x86)/Steam/steamapps/common/Don't Starve Together Beta/data/scripts/components/perishable.lua(173,1) in function 'Perish'
        C:/Program Files (x86)/Steam/steamapps/common/Don't Starve Together Beta/data/scripts/components/perishable.lua(67,1) in function 'fn'
        C:/Program Files (x86)/Steam/steamapps/common/Don't Starve Together Beta/data/scripts/scheduler.lua(170,1) in function 'OnTick'
        C:/Program Files (x86)/Steam/steamapps/common/Don't Starve Together Beta/data/scripts/scheduler.lua(381,1) in function 'RunScheduler'
        C:/Program Files (x86)/Steam/steamapps/common/Don't Starve Together Beta/data/scripts/update.lua(163,1)

 

I believe this can be fixed by rearranging the code in perishable.lua's Perish function:

			if holder then				holder:GiveItem(goop, slot)			else				goop.Transform:SetPosition(pt:Get())			end						if goop.components.stackable and self.inst.components.stackable then				goop.components.stackable:SetStackSize(self.inst.components.stackable.stacksize)			end

If this is rearranged so the "if holder" block goes after the "if goop" block, then the crash doesn't happen anymore and it seems to work as intended:

			if goop.components.stackable and self.inst.components.stackable then				goop.components.stackable:SetStackSize(self.inst.components.stackable.stacksize)			end			if holder then				holder:GiveItem(goop, slot)			else				goop.Transform:SetPosition(pt:Get())			end

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...