Fix possible null dereference by bailing out of CheckObjCPropertyAttributes() early if the Decl* is null.

llvm-svn: 100483
This commit is contained in:
Ted Kremenek 2010-04-05 22:39:42 +00:00
parent b7a20ee5b5
commit b535782fc4
1 changed files with 4 additions and 1 deletions

View 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.