Skip to content

Commit

Permalink
chore: refactor nullchecks
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorus committed May 10, 2024
1 parent 99fb80d commit 5167cac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Yafc/Workspace/ProductionTable/ProductionTableView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ async void addRecipe(Recipe rec) {
var selectFuel = type != ProductDropdownType.Fuel ? null : (Action<Goods>)(fuel => {
recipe.RecordUndo().fuel = fuel;
});
var allProduction = goods == null ? Array.Empty<Recipe>() : variants == null ? goods.production : variants.SelectMany(x => x.production).Distinct().ToArray();
Recipe[] allProduction = variants?.SelectMany(x => x.production).Distinct().ToArray() ?? goods?.production ?? [];
Recipe[] fuelUseList = goods?.fuelFor.AsEnumerable().OfType<EntityCrafter>().SelectMany(e => e.recipes).OfType<Recipe>().Distinct().OrderBy(e => e, DataUtils.DefaultRecipeOrdering).ToArray() ?? [];
var fuelDisplayFunc = recipe?.entity?.energy.type == EntityEnergyType.FluidHeat
? (Func<Goods, string>)(g => DataUtils.FormatAmount(g.fluid?.heatValue ?? 0, UnitOfMeasure.Megajoule))
Expand Down

0 comments on commit 5167cac

Please sign in to comment.