fix crash when trying to access to stashPlayerUnits when not in game

This commit is contained in:
guiyomu-dev
2025-10-31 15:25:49 +01:00
parent c07a000f34
commit af2f8c7d5c

View File

@@ -49,6 +49,12 @@ func (gd *GameReader) Inventory(rawPlayerUnits RawPlayerUnits, hover data.HoverD
}
belt := data.Belt{}
// Early return if not in-game to avoid any crash
if mainPlayer.Area == 0 {
inventory.Belt = belt
return inventory
}
type socketInfo struct {
item *data.Item
position int // Store X position