Fix NULL pointer crash in HighlightAvailableStorages#140
Fix NULL pointer crash in HighlightAvailableStorages#140tacticalcatboy wants to merge 1 commit intoArmaOverthrow:mainfrom
Conversation
Overrides HighlightAvailableStorages in SCR_InventoryMenuUI to add null checks and prevent crashes in the vanilla implementation when certain UI or storage components are missing. Original error, when you try to move items in your inventory during testing worlds these errors would pop up "Virtual Machine Exception Reason: NULL pointer to instance Class: 'SCR_InventoryMenuUI' Function: 'HighlightAvailableStorages' Stack trace: Scripts/Game/UI/Inventory/SCR_InventoryMenuUI.c:5122 Function HighlightAvailableStorages Scripts/Game/UI/Inventory/SCR_InventoryMenuUI.c:4857 Function Action_OnDrag"
|
I am pretty skeptical about this override because the original method is ~138 lines long and this is less than 30, and also doesn't do a lot of the things that the original does. I suspect that with this override it is possible to desync the inventory UI from what is actually in the inventory, because the original method does a lot of checks for various situations where the storage should not be highlighted for various reasons, whereas this override does none. Granted, I have not tested this theory. |
|
I identified the root cause to be a missing entity catalogue, specifically the SUPPLY_CONTAINER_ITEM catalogue. I made a pull request #141 to add an empty catalogue of this type to fix the error. I believe the game should handle it if this catalogue doesn't exist, but that's to be discussed in Feedback Tracker. |
Overrides HighlightAvailableStorages in SCR_InventoryMenuUI to add null checks and prevent crashes in the vanilla implementation when certain UI or storage components are missing.
Original error, when you try to move items in your inventory during testing worlds these errors would pop up
Virtual Machine Exception
Reason: NULL pointer to instance
Class: 'SCR_InventoryMenuUI'
Function: 'HighlightAvailableStorages'
Stack trace:
Scripts/Game/UI/Inventory/SCR_InventoryMenuUI.c:5122 Function HighlightAvailableStorages
Scripts/Game/UI/Inventory/SCR_InventoryMenuUI.c:4857 Function Action_OnDrag