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
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 52b9bcf..6057504 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -984,7 +984,10 @@
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.