From: Sung Yoon Whang Date: Sun, 6 Jun 2021 03:35:12 +0000 (-0700) Subject: Fix a NullRefException by finished process (#2338) X-Git-Tag: submit/tizen/20220302.040122~25^2^2~81 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=080d27ee37c8e2a264a8d417dbb3ba94f0201028;p=platform%2Fcore%2Fdotnet%2Fdiagnostics.git Fix a NullRefException by finished process (#2338) --- diff --git a/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs b/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs index 14c66b3fc..3764b1da9 100644 --- a/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs +++ b/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs @@ -312,7 +312,7 @@ namespace Microsoft.Diagnostics.Tools.Trace // If the process is shutting down by itself print the return code from the process. // Capture this before leaving the using, as the Dispose of the DiagnosticsClientHolder // may terminate the target process causing it to have the wrong error code - if (ProcessLauncher.Launcher.ChildProc.WaitForExit(5000)) + if (ProcessLauncher.Launcher.HasChildProc && ProcessLauncher.Launcher.ChildProc.WaitForExit(5000)) { ret = ProcessLauncher.Launcher.ChildProc.ExitCode; Console.WriteLine($"Process exited with code '{ret}'.");