diff options
author | Ted Kremenek <kremenek@apple.com> | 2013-01-23 21:12:49 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2013-01-23 21:12:49 +0000 |
commit | b33349e605a7373b067f7b96619e27c57c13932b (patch) | |
tree | 07c74b3949af992f4c7377374ad74c76065dda7b | |
parent | a5b6469a55fb8796353b073f6c12694b0adc77c2 (diff) |
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
-rw-r--r-- | lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
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<AnalyzerNoReturnAttr>()) { - C.generateSink(); - return; + if (const ObjCMethodDecl *MD = Msg.getDecl()) { + MD = MD->getCanonicalDecl(); + if (MD->hasAttr<AnalyzerNoReturnAttr>()) { + C.generateSink(); + return; + } } // HACK: This entire check is to handle two messages in the Cocoa frameworks: |