Handle the case when getEndPath() returns NULL.

llvm-svn: 49155
This commit is contained in:
Ted Kremenek 2008-04-03 07:33:55 +00:00
parent 4d26d194e4
commit ca40664275
1 changed files with 8 additions and 2 deletions

View 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);
}