Fix crash in SwitchStmt::TypeCheck() with malformed programs.
This commit is contained in:
7
stmt.cpp
7
stmt.cpp
@@ -2586,9 +2586,12 @@ SwitchStmt::Print(int indent) const {
|
|||||||
|
|
||||||
Stmt *
|
Stmt *
|
||||||
SwitchStmt::TypeCheck() {
|
SwitchStmt::TypeCheck() {
|
||||||
const Type *exprType = expr->GetType();
|
const Type *exprType;
|
||||||
if (exprType == NULL)
|
if (expr == NULL ||
|
||||||
|
(exprType = expr->GetType()) == NULL) {
|
||||||
|
Assert(m->errorCount > 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
const Type *toType = NULL;
|
const Type *toType = NULL;
|
||||||
exprType = exprType->GetAsConstType();
|
exprType = exprType->GetAsConstType();
|
||||||
|
|||||||
Reference in New Issue
Block a user