From ca40664275eb6c465b924f6745afb40cd696b6a0 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 3 Apr 2008 07:33:55 +0000 Subject: [PATCH] Handle the case when getEndPath() returns NULL. llvm-svn: 49155 --- clang/lib/Analysis/BugReporter.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/clang/lib/Analysis/BugReporter.cpp b/clang/lib/Analysis/BugReporter.cpp index ef919a373666..c5a59e20d874 100644 --- a/clang/lib/Analysis/BugReporter.cpp +++ b/clang/lib/Analysis/BugReporter.cpp @@ -64,7 +64,11 @@ void BugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, ASTContext& Ctx, const BugDescription& B, ExplodedGraph& G, ExplodedNode* N) { - PD.push_back(B.getEndPath(Ctx, N)); + + if (PathDiagnosticPiece* Piece = B.getEndPath(Ctx,N)) + PD.push_back(Piece); + else + return; SourceManager& SMgr = Ctx.getSourceManager(); @@ -249,7 +253,9 @@ void BugReporter::EmitPathWarning(Diagnostic& Diag, PathDiagnostic D(B.getName()); GeneratePathDiagnostic(D, Ctx, B, G, N); - PDC->HandlePathDiagnostic(D); + + if (!D.empty()) + PDC->HandlePathDiagnostic(D); }