Skip to content

Commit 5167cac

Browse files
committed
chore: refactor nullchecks
1 parent 99fb80d commit 5167cac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Yafc/Workspace/ProductionTable/ProductionTableView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ async void addRecipe(Recipe rec) {
693693
var selectFuel = type != ProductDropdownType.Fuel ? null : (Action<Goods>)(fuel => {
694694
recipe.RecordUndo().fuel = fuel;
695695
});
696-
var allProduction = goods == null ? Array.Empty<Recipe>() : variants == null ? goods.production : variants.SelectMany(x => x.production).Distinct().ToArray();
696+
Recipe[] allProduction = variants?.SelectMany(x => x.production).Distinct().ToArray() ?? goods?.production ?? [];
697697
Recipe[] fuelUseList = goods?.fuelFor.AsEnumerable().OfType<EntityCrafter>().SelectMany(e => e.recipes).OfType<Recipe>().Distinct().OrderBy(e => e, DataUtils.DefaultRecipeOrdering).ToArray() ?? [];
698698
var fuelDisplayFunc = recipe?.entity?.energy.type == EntityEnergyType.FluidHeat
699699
? (Func<Goods, string>)(g => DataUtils.FormatAmount(g.fluid?.heatValue ?? 0, UnitOfMeasure.Megajoule))

0 commit comments

Comments
 (0)