Fix for not sanitizing actions when accessing the task result

This commit is contained in:
Asriel Camora
2023-12-30 16:26:22 -08:00
parent 5c82f720fd
commit 511d1964c7
+4 -3
View File
@@ -9,10 +9,11 @@ public sealed class Solver : IDisposable
public SolverConfig Config { get; }
public SimulationState State { get; }
public CancellationToken Token { get; init; }
public SolverSolution? Solution { get; private set; }
private SolverSolution? Solution { get; set; }
public SolverSolution? SanitizedSolution => Solution.HasValue ? Solution.Value with { ActionEnumerable = Solution.Value.Actions.SelectMany(SolverSolution.SanitizeCombo) } : null;
public bool IsStarted => CompletionTask != null;
public bool IsCompletedSuccessfully => Solution != null;
public bool IsCompletedSuccessfully => Solution.HasValue;
public bool IsCompleted => CompletionTask?.IsCompleted ?? false;
private Func<Task<SolverSolution>> SearchFunc { get; }
@@ -76,7 +77,7 @@ public sealed class Solver : IDisposable
await CompletionTask!.ConfigureAwait(false);
return Solution!.Value;
return SanitizedSolution!.Value;
}
public async Task<SolverSolution?> GetSafeTask()