From a6420aff9bad4c8f43e2f3c7ee6d1e03b14b9b3b Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 31 Dec 2024 09:38:32 +0800 Subject: [PATCH] fix: crash if the executable file can not be found --- src/Commands/ExecuteCustomAction.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Commands/ExecuteCustomAction.cs b/src/Commands/ExecuteCustomAction.cs index 4981b2f9..a10f5387 100644 --- a/src/Commands/ExecuteCustomAction.cs +++ b/src/Commands/ExecuteCustomAction.cs @@ -53,6 +53,16 @@ namespace SourceGit.Commands proc.BeginOutputReadLine(); proc.BeginErrorReadLine(); proc.WaitForExit(); + + var exitCode = proc.ExitCode; + if (exitCode != 0) + { + var errMsg = builder.ToString(); + Dispatcher.UIThread.Invoke(() => + { + App.RaiseException(repo, errMsg); + }); + } } catch (Exception e) { @@ -62,17 +72,7 @@ namespace SourceGit.Commands }); } - var exitCode = proc.ExitCode; proc.Close(); - - if (exitCode != 0) - { - var errMsg = builder.ToString(); - Dispatcher.UIThread.Invoke(() => - { - App.RaiseException(repo, errMsg); - }); - } } } }