diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-04-05 22:39:42 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-04-05 22:39:42 +0000 |
commit | 5fcd52a6c94c7f93bd80062248353c45330da23a (patch) | |
tree | 788716e0f81e0a6c8dba4c39461b05301b50318f /lib/Sema/SemaObjCProperty.cpp | |
parent | caff6ea81835ff0a1f5cc9cf8e6bad70db457806 (diff) |
Fix possible null dereference by bailing out of CheckObjCPropertyAttributes() early if the Decl* is null.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100483 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaObjCProperty.cpp')
-rw-r--r-- | lib/Sema/SemaObjCProperty.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index 52b9bcf86c..605750408c 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -984,7 +984,10 @@ void Sema::CheckObjCPropertyAttributes(DeclPtrTy PropertyPtrTy, unsigned &Attributes) { // FIXME: Improve the reported location. Decl *PDecl = PropertyPtrTy.getAs<Decl>(); - ObjCPropertyDecl *PropertyDecl = dyn_cast_or_null<ObjCPropertyDecl>(PDecl); + if (!PDecl) + return; + + ObjCPropertyDecl *PropertyDecl = cast<ObjCPropertyDecl>(PDecl); QualType PropertyTy = PropertyDecl->getType(); // readonly and readwrite/assign/retain/copy conflict. |