Critical-Impact / InventoryTools

Dalamud plugin for inventory tracking
GNU General Public License v3.0
41 stars 28 forks source link

AT crashes if you ask the crafting menu to plan resources for too large a number of items #203

Closed goldirocks closed 1 year ago

goldirocks commented 1 year ago

Describe the bug I attempted to ask AT to tell me the number of resources required to craft 150 of a few things and 200 of another, and it crashed.

To Reproduce Steps to reproduce the behavior: (It's not reproducing for me trying this again just now on a fresh game start, but what I did was add 150 each of Bayberry Cloth and Ilmenite Ingot, then 100 Jhammel Moussaka and Jerked Jhammel, then 200 Craftsman's Alkahest, and it went bang. Trace below.)

Expected behavior The plugin to not null pointer dereference.

Screenshots

2023-05-17 23:40:35.749 -04:00 [FTL] Unhandled exception on AppDomain
System.NullReferenceException: Object reference not set to an instance of an object.
   at CriticalCommonLib.Crafting.CraftItem.GetFlattenedMaterials() in /work/repo/CriticalCommonLib/Crafting/CraftItem.cs:line 470
   at CriticalCommonLib.Crafting.CraftList.GetFlattenedMaterials() in /work/repo/CriticalCommonLib/Crafting/CraftList.cs:line 193
   at CriticalCommonLib.Crafting.CraftList.GetAvailableMaterialsList() in /work/repo/CriticalCommonLib/Crafting/CraftList.cs:line 231
   at InventoryTools.Logic.FilterConfiguration.FilterItem(InventoryItem item) in /work/repo/InventoryTools/Logic/FilterConfiguration.cs:line 1082
   at InventoryTools.Logic.FilterConfiguration.GenerateFilteredListInternal(FilterConfiguration filter, Dictionary`2 inventories) in /work/repo/InventoryTools/Logic/FilterConfiguration.cs:line 2607
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at InventoryTools.Logic.FilterConfiguration.StartRefresh() in /work/repo/InventoryTools/Logic/FilterConfiguration.cs:line 268
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

Dalamud Information: Do you have testing enabled? Yes.

Filter Issues N/A

Additional context It doesn't reproduce on immediate game start, so it seems to be either a race or something about persistent state that is no longer true? Dunno. It was very grumpy indeed.

Version 1.5.0.1 from Dalamud's repos, no spicy build from git directly or something.

Critical-Impact commented 1 year ago

Should be good in the latest version, please open a new issue if it's not :)