From 511d1964c729949049ac1c29668c2f0618149eb8 Mon Sep 17 00:00:00 2001 From: Asriel Camora Date: Sat, 30 Dec 2023 16:26:22 -0800 Subject: [PATCH] Fix for not sanitizing actions when accessing the task result --- Solver/Solver.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Solver/Solver.cs b/Solver/Solver.cs index b552e7d..b16ddea 100644 --- a/Solver/Solver.cs +++ b/Solver/Solver.cs @@ -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> SearchFunc { get; } @@ -76,7 +77,7 @@ public sealed class Solver : IDisposable await CompletionTask!.ConfigureAwait(false); - return Solution!.Value; + return SanitizedSolution!.Value; } public async Task GetSafeTask()