From d3a374e71c1927d84a9ab8f0fac521625122ec14 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Sun, 25 Mar 2012 13:10:23 -0700 Subject: [PATCH] Fix malformed program crasher. --- type.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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