This led to a crash on invalid code (sorry, no good test case).
Fixes <rdar://problem/
15831804>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199571
91177308-0d34-0410-b5e6-
96231b3b80d8
const ArrayType *AT = getType()->getAsArrayTypeUnsafe();
if (!AT || !AT->getElementType()->isIntegerType())
return false;
- const Expr *Init = getInit(0)->IgnoreParens();
+ // It is possible for getInit() to return null.
+ const Expr *Init = getInit(0);
+ if (!Init)
+ return false;
+ Init = Init->IgnoreParens();
return isa<StringLiteral>(Init) || isa<ObjCEncodeExpr>(Init);
}