]> granicus.if.org Git - clang/commitdiff
Fix dereference of end iterator. Spotted by ASan.
authorMatt Beaumont-Gay <matthewbg@google.com>
Wed, 14 Mar 2012 20:21:25 +0000 (20:21 +0000)
committerMatt Beaumont-Gay <matthewbg@google.com>
Wed, 14 Mar 2012 20:21:25 +0000 (20:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152738 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CallGraph.cpp

index 1e9aec23dd62ce6dd4a936c0be981627ee45f87b..eb3f3ef97acbb38006ad42d65a215384bc570889 100644 (file)
@@ -133,7 +133,9 @@ void CallGraph::addToCallGraph(TranslationUnitDecl *TU) {
 }
 
 CallGraphNode *CallGraph::getNode(const Decl *F) const {
-  return FunctionMap.find(F)->second;
+  FunctionMapTy::const_iterator I = FunctionMap.find(F);
+  if (I == FunctionMap.end()) return 0;
+  return I->second;
 }
 
 CallGraphNode *CallGraph::getOrInsertFunction(Decl *F) {