aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/BugReporter.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-04-02 03:44:00 +0000
committerTed Kremenek <kremenek@apple.com>2009-04-02 03:44:00 +0000
commit0ddaff3a558cca0d1157c3f63e3ad82b72cf625a (patch)
tree821217cacbfb61c3117547d8118b7f7008306337 /lib/Analysis/BugReporter.cpp
parentc2dcd89e4b0fe36e3c9654b7aa83efc2f0e68e28 (diff)
Add another null pointer check. Simplify condition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68283 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BugReporter.cpp')
-rw-r--r--lib/Analysis/BugReporter.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp
index 7637a1614c..2baef5e4bf 100644
--- a/lib/Analysis/BugReporter.cpp
+++ b/lib/Analysis/BugReporter.cpp
@@ -806,15 +806,16 @@ static void GenExtAddEdge(PathDiagnostic& PD,
// FIXME: We need a version of getParent that ignores '()' and casts.
const Stmt *parentY = PDB.getParent(Y.asStmt());
- if (IsControlFlowExpr(parentX)) {
- if (IsControlFlowExpr(parentY) && parentX == parentY) {
+ if (parentX && IsControlFlowExpr(parentX)) {
+ if (parentX == parentY)
break;
- }
else {
- const PathDiagnosticLocation &W =
- PDB.getEnclosingStmtLocation(PDB.getParent(parentX));
-
- if (W != Y) X = W;
+ if (const Stmt *grandparentX = PDB.getParent(parentX)) {
+ const PathDiagnosticLocation &W =
+ PDB.getEnclosingStmtLocation(grandparentX);
+
+ if (W != Y) X = W;
+ }
}
}