Free, open-source Windows optimization tool for performance, privacy, and simplicity.
C# csharpdebloatdotnetgamingopen-sourceoptimizationoptimizeroptimizerduckperformanceprivacytweakertweakswindowswinui
fix: add jsonexception catching when loading revert data, and remove powershell tests to let CI build successfully (CI can't run powershell i think)
fatDuckbd551e0708ac
diff --git a/optimizerDuck.Test/Services/OptimizationServices/ShellServiceTests.cs b/optimizerDuck.Test/Services/OptimizationServices/ShellServiceTests.csindex 68376e5..dc4a110 100644--- a/optimizerDuck.Test/Services/OptimizationServices/ShellServiceTests.cs+++ b/optimizerDuck.Test/Services/OptimizationServices/ShellServiceTests.cs@@ -27,17 +27,4 @@ public class ShellServiceTestsAssert.Equal(0, result.ExitCode);}-- [Theory]- [InlineData("Tiếng Việt có dấu")]- [InlineData("Zażółć gęślą jaźń")]- [InlineData("Español – información")]- [InlineData("Français – élève")]- [InlineData("Deutsch – äußern")]- public void PowerShell_MultiLanguageUnicode_ReturnsCorrectString(string text)- {- var result = ShellService.PowerShell($"Write-Output '{text}'");-- Assert.Contains(text, result.Stdout);- }}\ No newline at end of filediff --git a/optimizerDuck/Services/Managers/RevertManager.cs b/optimizerDuck/Services/Managers/RevertManager.csindex 6f51b50..25f35b6 100644--- a/optimizerDuck/Services/Managers/RevertManager.cs+++ b/optimizerDuck/Services/Managers/RevertManager.cs@@ -152,8 +152,23 @@ public class RevertManager(ILogger<RevertManager> logger, ILoggerFactory loggerFprivate static async Task<RevertData?> LoadAsync(string path){if (!File.Exists(path)) return null;- var content = await File.ReadAllTextAsync(path);- return string.IsNullOrWhiteSpace(content) ? null : JsonConvert.DeserializeObject<RevertData>(content);++ try+ {+ var content = await File.ReadAllTextAsync(path);+ if (string.IsNullOrWhiteSpace(content))+ return null;++ return JsonConvert.DeserializeObject<RevertData>(content);+ }+ catch (JsonException)+ {+ return null;+ }+ catch (IOException)+ {+ return null;+ }}private static async Task WriteJsonAsync(string path, RevertData data)