The __instance variable in the patch prefix can be null, which raised a NullReference Exception when sorting inventories.
This commit adds a check for that variable and sets it to the currently open ItemGrabMenu instance if needed.
Additionally, a check for the sort and group by values being default was added to this function, as there was a recursion that was caused by the BetterItemGrabMenu.Context.OrganizeItems() function, as it was calling the built-in organization function, but the patch prefix called the above mentioned function again, causing recursion.
Now if the Sort and Group values are set to default for the inventory being sorted, the patch prefix calls the proper function as intended.
The
__instance
variable in the patch prefix can be null, which raised a NullReference Exception when sorting inventories. This commit adds a check for that variable and sets it to the currently open ItemGrabMenu instance if needed.Additionally, a check for the sort and group by values being default was added to this function, as there was a recursion that was caused by the
BetterItemGrabMenu.Context.OrganizeItems()
function, as it was calling the built-in organization function, but the patch prefix called the above mentioned function again, causing recursion. Now if the Sort and Group values are set to default for the inventory being sorted, the patch prefix calls the proper function as intended.