Failed to call hook 'OnInventoryItemsTake' on plugin 'ItemRetriever v0.6.2' (NullReferenceException: Object reference not set to an instance of an object)
at Oxide.Plugins.Backpacks+ItemUtils.HasSearchableContainer (Oxide.Plugins.Backpacks+ItemData itemData, System.Collections.Generic.List`1[Oxide.Plugins.Backpacks+ItemData]& itemDataList) [0x00000] in <1389e9076a414ded9ae9607ed20e6df7>:0
at Oxide.Plugins.Backpacks+ItemUtils.TakeItems (System.Collections.Generic.List`1[T] itemDataList, Oxide.Plugins.Backpacks+ItemQuery& itemQuery, System.Int32 amount, System.Collections.Generic.List`1[T] collect) [0x00087] in <1389e9076a414ded9ae9607ed20e6df7>:0
at Oxide.Plugins.Backpacks+VirtualContainerAdapter.TakeItems (Oxide.Plugins.Backpacks+ItemQuery& itemQuery, System.Int32 amount, System.Collections.Generic.List`1[T] collect) [0x0000d] in <1389e9076a414ded9ae9607ed20e6df7>:0
at Oxide.Plugins.Backpacks+Backpack.TakeItems (Oxide.Plugins.Backpacks+ItemQuery& itemQuery, System.Int32 amount, System.Collections.Generic.List`1[T] collect, System.Boolean forItemRetriever) [0x00055] in <1389e9076a414ded9ae9607ed20e6df7>:0
at Oxide.Plugins.Backpacks.<RegisterAsItemSupplier>m__4 (BasePlayer player, System.Collections.Generic.Dictionary`2[TKey,TValue] rawItemQuery, System.Int32 amount, System.Collections.Generic.List`1[T] collect) [0x00037] in <1389e9076a414ded9ae9607ed20e6df7>:0
at Oxide.Plugins.ItemRetriever+SupplierManager.TakePlayerItems[T] (BasePlayer player, T& itemQuery, System.Int32 amountToTake, System.Collections.Generic.List`1[T] collect, System.Boolean beforeInventory) [0x00049] in <1389e9076a414ded9ae9607ed20e6df7>:0
at Oxide.Plugins.ItemRetriever.TakePlayerItems[T] (BasePlayer player, T& itemQuery, System.Int32 amountToTake, System.Collections.Generic.List`1[T] collect) [0x00093] in <1389e9076a414ded9ae9607ed20e6df7>:0
at Oxide.Plugins.ItemRetriever.OnInventoryItemsTake (PlayerInventory inventory, System.Collections.Generic.List`1[T] collect, System.Int32 itemId, System.Int32 amount) [0x0000f] in <1389e9076a414ded9ae9607ed20e6df7>:0
at Oxide.Plugins.ItemRetriever.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x002c1] in <1389e9076a414ded9ae9607ed20e6df7>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <23ba99f131254889867c71f0bd137b1d>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <157a94ee66ab4a7991faecd1eb84be3b>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <157a94ee66ab4a7991faecd1eb84be3b>:0
[Backpacks] New bug for youFixed
This error is originating in Backpacks. Looks like there's an item defined in the data file of a player's backpack, and that item is somehow null. Do you know which player's backpack this happened to? If so, can you provide their backpack data file?
IM not sure which player, but I can send you all the backpack files if you like? there is only 842 files this month
Sure, just DM me a link to a zip file.
Merged post
Thanks for that. I didn't find any nulls in there, so I looked at the code and found an edge case that can occur.
If the player connects to the server, opens page 1, but does not open page 2, then retrieves an item from page 2, fully consuming that item, but that item was not enough, this error occurs. I was able to reproduce it once I knew what to look for.
This happens because pages not visited use virtual representations composed of virtual items which are pooled for memory efficiency. When one of those virtual items is consumed, the item is added back to a pool, and corrsponding variable is set to null, causing subsequent code in the function to throw a NullReferenceException when checking if that item had a searchable inner container. I just pushed a fix in Backpacks v3.11.8.