Handle the case when getEndPath() returns NULL.
llvm-svn: 49155
diff --git a/clang/lib/Analysis/BugReporter.cpp b/clang/lib/Analysis/BugReporter.cpp
index ef919a3..c5a59e2 100644
--- a/clang/lib/Analysis/BugReporter.cpp
+++ b/clang/lib/Analysis/BugReporter.cpp
@@ -64,7 +64,11 @@
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 @@
PathDiagnostic D(B.getName());
GeneratePathDiagnostic(D, Ctx, B, G, N);
- PDC->HandlePathDiagnostic(D);
+
+ if (!D.empty())
+ PDC->HandlePathDiagnostic(D);
}