Added null check in inventory count item slots