Fix a potential NullReferenceException when counter session hasn't started yet (...
authorSung Yoon Whang <suwhang@microsoft.com>
Mon, 20 Jul 2020 22:07:53 +0000 (15:07 -0700)
committerGitHub <noreply@github.com>
Mon, 20 Jul 2020 22:07:53 +0000 (15:07 -0700)
* Fix a potential NullReferenceException when counter session hasn't started yet

* PR feedback

src/Tools/dotnet-counters/CounterMonitor.cs

index 8ab722ad12113c088664f72b09001391a6451e99..f25ef5f584095c4c77973ca5ec21103500b451b9 100644 (file)
@@ -61,7 +61,7 @@ namespace Microsoft.Diagnostics.Tools.Counters
         {
             try
             {
-                _session.Stop();
+                _session?.Stop();
             }
             catch (EndOfStreamException ex)
             {