cmd: Avoid division by zero in set /a with %.
This commit is contained in:
parent
45eeeb00f3
commit
3735bf6af5
|
@ -3661,6 +3661,7 @@ static int WCMD_reduce(OPSTACK **opstack, VARSTACK **varstack) {
|
||||||
WCMD_pushnumber(NULL, var2&var1, varstack);
|
WCMD_pushnumber(NULL, var2&var1, varstack);
|
||||||
break;
|
break;
|
||||||
case '%': var2 = WCMD_popnumber(varstack);
|
case '%': var2 = WCMD_popnumber(varstack);
|
||||||
|
if (var1 == 0) return WCMD_DIVIDEBYZERO;
|
||||||
WCMD_pushnumber(NULL, var2%var1, varstack);
|
WCMD_pushnumber(NULL, var2%var1, varstack);
|
||||||
break;
|
break;
|
||||||
case '^': var2 = WCMD_popnumber(varstack);
|
case '^': var2 = WCMD_popnumber(varstack);
|
||||||
|
|
Loading…
Reference in New Issue