From: Ted Kremenek Date: Thu, 3 Apr 2008 07:33:55 +0000 (+0000) Subject: Handle the case when getEndPath() returns NULL. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=70d1722c90e34c1a86c02b93e35f6a763548acb6;p=clang Handle the case when getEndPath() returns NULL. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49155 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp index ef919a3736..c5a59e20d8 100644 --- a/lib/Analysis/BugReporter.cpp +++ b/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); }