From 59e331279f278f891b018585c10b8ea2583b8672 Mon Sep 17 00:00:00 2001 From: Ankush Desai Date: Wed, 3 Apr 2024 15:15:03 -0700 Subject: [PATCH] Fixes a null pointer exception reported by the PChecker (#713) --- .../CheckerCore/Coverage/ActivityCoverageReporter.cs | 5 ++++- Src/PCompiler/PCommandLine/CommandLine.cs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Src/PChecker/CheckerCore/Coverage/ActivityCoverageReporter.cs b/Src/PChecker/CheckerCore/Coverage/ActivityCoverageReporter.cs index c3874385a..e0b29a15c 100644 --- a/Src/PChecker/CheckerCore/Coverage/ActivityCoverageReporter.cs +++ b/Src/PChecker/CheckerCore/Coverage/ActivityCoverageReporter.cs @@ -53,7 +53,10 @@ public void EmitCoverageReport(string coverageFile) { using (var writer = new StreamWriter(coverageFile)) { - WriteCoverageText(writer); + if (CoverageInfo.CoverageGraph != null) + { + WriteCoverageText(writer); + } } } diff --git a/Src/PCompiler/PCommandLine/CommandLine.cs b/Src/PCompiler/PCommandLine/CommandLine.cs index 19a065140..5fc655fe0 100644 --- a/Src/PCompiler/PCommandLine/CommandLine.cs +++ b/Src/PCompiler/PCommandLine/CommandLine.cs @@ -125,7 +125,7 @@ private static void PrintException(Exception ex) lock (ConsoleLock) { Error.Report($"[Internal Error]:\n {ex.Message}\n"); - Error.Report("[PTool] unhandled exception: {0}: {1}", ex.GetType().ToString(), ex.Message); + Error.Report("[PTool] unhandled exception: {0}: {1}\n Stack Trace: {2}", ex.GetType().ToString(), ex.Message, ex.StackTrace); } }