Tarray Break

If Inventory[0] breaks your game, it’s probably a nullptr. You’re calling the function NextWeapon while the inventory is empty. This is most likely a problem caused somewhere else in your code.