Skwizzy / SPT-LootingBots

AI Looting mod for Singleplayer Tarkov
https://hub.sp-tarkov.com/files/file/1096-looting-bots/#overview
30 stars 10 forks source link

Rare exception when looting containers #44

Closed Skwizzy closed 1 year ago

Skwizzy commented 1 year ago

Solarint has reported seeing the following exception when a container is looted: [Error :LootingBots] System.NullReferenceException: Object reference not set to an instance of an object at GClass2411.GetRootItem (EFT.InventoryLogic.ItemAddress itemAddress) [0x00008] in <a751280e1c2f49a499ea8f5770107520>:0 at LootingBots.Patch.Util.TransactionController+<moveItem>d__10.MoveNext () [0x0005a] in <df22bb14a7f44123b146a499e7d901b4>:0

Not exactly sure the recreate steps and this seems like an exception that is vary rarely seen, perhaps just need some extra null checks around RootItem

Skwizzy commented 1 year ago

This seems to be coming from the check to see if an item is a Weapon. Items like bullets and flare guns are considered weapons and causes errors in the weapon equip logic

Skwizzy commented 1 year ago

Added an additional check to not equip flare guns and checking item Template class (WeaponTemplate) instead of item class (Weapon)

Skwizzy commented 1 year ago

Solarint said he saw this issue again, will need to reproduce before reopening