diff --git a/Yafc.Parser/Data/FactorioDataDeserializer.cs b/Yafc.Parser/Data/FactorioDataDeserializer.cs index 2ca2d218..18ad5e9c 100644 --- a/Yafc.Parser/Data/FactorioDataDeserializer.cs +++ b/Yafc.Parser/Data/FactorioDataDeserializer.cs @@ -163,7 +163,7 @@ public Project LoadData(string projectPath, LuaTable data, LuaTable prototypes, UpdateSplitFluids(); var iconRenderTask = renderIcons ? Task.Run(RenderIcons) : Task.CompletedTask; - UpdateRecipeIngredientFluids(); + UpdateRecipeIngredientFluids(errorCollector); UpdateRecipeCatalysts(); CalculateMaps(netProduction); ExportBuiltData(); diff --git a/Yafc.Parser/Data/FactorioDataDeserializer_RecipeAndTechnology.cs b/Yafc.Parser/Data/FactorioDataDeserializer_RecipeAndTechnology.cs index ff550a53..9c2a039b 100644 --- a/Yafc.Parser/Data/FactorioDataDeserializer_RecipeAndTechnology.cs +++ b/Yafc.Parser/Data/FactorioDataDeserializer_RecipeAndTechnology.cs @@ -68,8 +68,14 @@ private void UpdateRecipeCatalysts() { } } - private void UpdateRecipeIngredientFluids() { + private void UpdateRecipeIngredientFluids(ErrorCollector errorCollector) { foreach (var recipe in allObjects.OfType()) { + if (recipe.ingredients == null || recipe.products == null) { + errorCollector.Error($"The recipe '{recipe.name}' is not defined in data.raw[\"recipe\"].", ErrorSeverity.Important); + recipe.ingredients = []; + recipe.products = []; + continue; + } foreach (var ingredient in recipe.ingredients) { if (ingredient.goods is Fluid fluid && fluid.variants != null) { int min = -1, max = fluid.variants.Count - 1; diff --git a/changelog.txt b/changelog.txt index 651ca8ca..dda01cb0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -19,6 +19,7 @@ Version: Date: Fixes: - "Map generated" entities that don't generate in any locations could break automation analysis. + - Recipes that are referenced without being defined do not prevent YAFC from loading. ---------------------------------------------------------------------------------------------------------------------- Version: 2.4.0 Date: November 21st 2024