]> granicus.if.org Git - clang/commitdiff
Fix possible null dereference by bailing out of CheckObjCPropertyAttributes() early...
authorTed Kremenek <kremenek@apple.com>
Mon, 5 Apr 2010 22:39:42 +0000 (22:39 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 5 Apr 2010 22:39:42 +0000 (22:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100483 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaObjCProperty.cpp

index 52b9bcf86c8d0e0d092cab2f0c8e4727e504ae03..605750408ce3b2c1e3cedc6d5ef90272a43d25ae 100644 (file)
@@ -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.