comparison lwlib/lw_expr.c @ 250:644f8abf87dc

Apply division by zero fix to modulus operator too. Modulus is also division. It also needs protection against division by zero.
author William Astle <lost@l-w.ca>
date Fri, 25 Jan 2013 21:54:02 -0700
parents 1f1a28b797e1
children 346966cffeef
comparison
equal deleted inserted replaced
249:1f1a28b797e1 250:644f8abf87dc
742 } 742 }
743 tr = E -> operands -> p -> value / E -> operands -> next -> p -> value; 743 tr = E -> operands -> p -> value / E -> operands -> next -> p -> value;
744 break; 744 break;
745 745
746 case lw_expr_oper_mod: 746 case lw_expr_oper_mod:
747 if (E -> operands -> next -> p -> value == 0)
748 {
749 tr = 0;
750 lw_expr_divzero(priv);
751 break;
752 }
747 tr = E -> operands -> p -> value % E -> operands -> next -> p -> value; 753 tr = E -> operands -> p -> value % E -> operands -> next -> p -> value;
748 break; 754 break;
749 755
750 case lw_expr_oper_intdiv: 756 case lw_expr_oper_intdiv:
751 if (E -> operands -> next -> p -> value == 0) 757 if (E -> operands -> next -> p -> value == 0)