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 39ab06a commit ea21db1
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 @@ -691,7 +691,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 ?? [];
var fuelDisplayFunc = recipe?.entity?.energy.type == EntityEnergyType.FluidHeat
? (Func<Goods, string>)(g => DataUtils.FormatAmount(g.fluid?.heatValue ?? 0, UnitOfMeasure.Megajoule))
: g => DataUtils.FormatAmount(g.fuelValue, UnitOfMeasure.Megajoule);
Expand Down

0 comments on commit ea21db1

Please sign in to comment.