// This must be a TypeSwitchGuard.
switch_val = this->simple_stat(false, true, NULL,
&type_switch);
- if (!type_switch.found
- && !switch_val->is_error_expression())
+ if (!type_switch.found)
{
- error_at(id_loc, "expected type switch assignment");
- switch_val = Expression::make_error(id_loc);
+ if (switch_val == NULL
+ || !switch_val->is_error_expression())
+ {
+ error_at(id_loc, "expected type switch assignment");
+ switch_val = Expression::make_error(id_loc);
+ }
}
}
}