]> granicus.if.org Git - clang/commitdiff
Handle the case when getEndPath() returns NULL.
authorTed Kremenek <kremenek@apple.com>
Thu, 3 Apr 2008 07:33:55 +0000 (07:33 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 3 Apr 2008 07:33:55 +0000 (07:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49155 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/BugReporter.cpp

index ef919a37366618288d1f57ae47358c31b9394aaa..c5a59e20d8747f6b574e12b5e69348785ccb4b43 100644 (file)
@@ -64,7 +64,11 @@ void BugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, ASTContext& Ctx,
                                          const BugDescription& B,
                                          ExplodedGraph<GRExprEngine>& G,
                                          ExplodedNode<ValueState>* 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);
 }