diff --git a/type.cpp b/type.cpp index 0fb8817e..06ab8bd2 100644 --- a/type.cpp +++ b/type.cpp @@ -2014,6 +2014,10 @@ StructType::GetElementType(int i) const { Assert(variability != Variability::Unbound); Assert(i < (int)elementTypes.size()); const Type *ret = elementTypes[i]; + if (ret == NULL) { + Assert(m->errorCount > 0); + return NULL; + } // If the element has unbound variability, resolve its variability to // the struct type's variability