diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2012-02-09 03:29:06 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2012-02-09 03:29:06 +0000 |
commit | 0ca7e8bf904d1c2cf70d271f3a06c1d71ff7e4fb (patch) | |
tree | 371ad09395b6f69b47c013b0e0df35bbc0c17acd /lib/Sema/SemaInit.cpp | |
parent | c6a6369b82db5b51769c4eaa29f8b0199142577a (diff) |
Attempting to initialize a union member that does not exist no longer crashes.
Patch by Remi Gacogne
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150144 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaInit.cpp')
-rw-r--r-- | lib/Sema/SemaInit.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index ece019c3a7..759fb16d1a 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -1511,7 +1511,8 @@ static IndirectFieldDecl *FindIndirectFieldDesignator(FieldDecl *AnonField, IdentifierInfo *FieldName) { assert(AnonField->isAnonymousStructOrUnion()); Decl *NextDecl = AnonField->getNextDeclInContext(); - while (IndirectFieldDecl *IF = dyn_cast<IndirectFieldDecl>(NextDecl)) { + IndirectFieldDecl *IF = NULL; + while (NextDecl && (IF = dyn_cast<IndirectFieldDecl>(NextDecl))) { if (FieldName && FieldName == IF->getAnonField()->getIdentifier()) return IF; NextDecl = NextDecl->getNextDeclInContext(); |