Fix malformed program crasher.
This commit is contained in:
4
type.cpp
4
type.cpp
@@ -2014,6 +2014,10 @@ StructType::GetElementType(int i) const {
|
|||||||
Assert(variability != Variability::Unbound);
|
Assert(variability != Variability::Unbound);
|
||||||
Assert(i < (int)elementTypes.size());
|
Assert(i < (int)elementTypes.size());
|
||||||
const Type *ret = elementTypes[i];
|
const Type *ret = elementTypes[i];
|
||||||
|
if (ret == NULL) {
|
||||||
|
Assert(m->errorCount > 0);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// If the element has unbound variability, resolve its variability to
|
// If the element has unbound variability, resolve its variability to
|
||||||
// the struct type's variability
|
// the struct type's variability
|
||||||
|
|||||||
Reference in New Issue
Block a user