widl: Issue an error instead of crashing for dividing by zero in a constant expression.

This commit is contained in:
Rob Shearman 2008-04-20 22:15:36 +01:00 committed by Alexandre Julliard
parent c46fcfb356
commit efd10742ec
1 changed files with 5 additions and 1 deletions

View File

@ -1237,7 +1237,11 @@ static expr_t *make_expr2(enum expr_type type, expr_t *expr1, expr_t *expr2)
e->cval = expr1->cval * expr2->cval;
break;
case EXPR_DIV:
e->cval = expr1->cval / expr2->cval;
if (expr2->cval == 0) {
error_loc("divide by zero in expression\n");
e->cval = 0;
} else
e->cval = expr1->cval / expr2->cval;
break;
case EXPR_OR:
e->cval = expr1->cval | expr2->cval;