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: http://review.tizen.org/git/?a=commitdiff_plain;h=5b4500b43a85cf206cd9a6c5e8a0b4b6eeb87c02;p=platform%2Fupstream%2Fllvm.git Add missing null check. Not sure why my tests passed before. llvm-svn: 173292 --- diff --git a/clang/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp index 351eabf..0009e1b 100644 --- a/clang/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp +++ b/clang/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: