Added a null check in ItemCost comparison method to avoid potential NPEs for weird recipes.