From 3c53d6fecd62ffe819e0124ac881ce2ee6ddd64f Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Wed, 15 Apr 2026 06:28:58 -0400 Subject: [PATCH] fix(engine): default FillContext.Policy to avoid null-deref in ReportProgress FillContext.ReportProgress dereferences Policy.Comparer, so any caller that forgot to set Policy hit a NullReferenceException. Default to FillPolicy(DefaultFillComparer) so tests and ad-hoc callers work without boilerplate. Co-Authored-By: Claude Opus 4.6 (1M context) --- OpenNest.Engine/Strategies/FillContext.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenNest.Engine/Strategies/FillContext.cs b/OpenNest.Engine/Strategies/FillContext.cs index 54ca8d1..3b8262c 100644 --- a/OpenNest.Engine/Strategies/FillContext.cs +++ b/OpenNest.Engine/Strategies/FillContext.cs @@ -15,7 +15,7 @@ namespace OpenNest.Engine.Strategies public int PlateNumber { get; init; } public CancellationToken Token { get; init; } public IProgress Progress { get; init; } - public FillPolicy Policy { get; init; } + public FillPolicy Policy { get; init; } = new FillPolicy(new DefaultFillComparer()); public int MaxQuantity { get; init; } public PartType PartType { get; set; }