From: Ted Kremenek Date: Wed, 23 Jan 2013 21:12:49 +0000 (+0000) Subject: Add missing null check. Not sure why my tests passed before. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b33349e605a7373b067f7b96619e27c57c13932b;p=clang Add missing null check. Not sure why my tests passed before. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173292 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp b/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp index 351eabf8df..0009e1b7cf 100644 --- a/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp @@ -102,10 +102,12 @@ static bool END_WITH_NULL isMultiArgSelector(const Selector *Sel, ...) { void NoReturnFunctionChecker::checkPostObjCMessage(const ObjCMethodCall &Msg, CheckerContext &C) const { // Check if the method is annotated with analyzer_noreturn. - const ObjCMethodDecl *MD = Msg.getDecl()->getCanonicalDecl(); - if (MD->hasAttr()) { - C.generateSink(); - return; + if (const ObjCMethodDecl *MD = Msg.getDecl()) { + MD = MD->getCanonicalDecl(); + if (MD->hasAttr()) { + C.generateSink(); + return; + } } // HACK: This entire check is to handle two messages in the Cocoa frameworks: