Add null checks to the InventoryUtil sanity checks.