0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.2378: Vim9: no error message for dividing by zero

Problem:    Vim9: no error message for dividing by zero.
Solution:   Give an error message. (issue #7704)
This commit is contained in:
Bram Moolenaar
2021-01-20 21:23:14 +01:00
parent a28639e711
commit 99880f96cf
5 changed files with 20 additions and 6 deletions

View File

@@ -2954,10 +2954,16 @@ call_def_function(
switch (iptr->isn_arg.op.op_type)
{
case EXPR_MULT: n1 = n1 * n2; break;
case EXPR_DIV: n1 = num_divide(n1, n2); break;
case EXPR_DIV: n1 = num_divide(n1, n2);
if (n2 == 0)
goto on_error;
break;
case EXPR_SUB: n1 = n1 - n2; break;
case EXPR_ADD: n1 = n1 + n2; break;
default: n1 = num_modulus(n1, n2); break;
default: n1 = num_modulus(n1, n2);
if (n2 == 0)
goto on_error;
break;
}
clear_tv(tv1);
clear_tv(tv2);