Bug fixes to avoid NULL pointer derefs with malformed programs.

This commit is contained in:
Matt Pharr
2012-02-06 12:41:55 -08:00
parent 96a429694f
commit a9ed71f553
3 changed files with 63 additions and 14 deletions

View File

@@ -2584,6 +2584,11 @@ AssignExpr::TypeCheck() {
}
const Type *lhsType = lvalue->GetType();
if (lhsType == NULL) {
Assert(m->errorCount > 0);
return NULL;
}
if (lhsType->IsConstType()) {
Error(lvalue->pos, "Can't assign to type \"%s\" on left-hand side of "
"expression.", lhsType->GetString().c_str());