diff src/evalvars.c @ 23679:e8c379b20765 v8.2.2381

patch 8.2.2381: Vim9: divide by zero does not abort expression execution Commit: https://github.com/vim/vim/commit/c5f59fab23820454f060562927ddc1397f9d479a Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 21 12:34:14 2021 +0100 patch 8.2.2381: Vim9: divide by zero does not abort expression execution Problem: Vim9: divide by zero does not abort expression execution. Solution: Use a "failed" flag. (issue https://github.com/vim/vim/issues/7704)
author Bram Moolenaar <Bram@vim.org>
date Thu, 21 Jan 2021 12:45:05 +0100
parents f8f460738aaa
children cd06cc37f53f
line wrap: on
line diff
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -1410,8 +1410,10 @@ ex_let_one(
 			    case '+': n = numval + n; break;
 			    case '-': n = numval - n; break;
 			    case '*': n = numval * n; break;
-			    case '/': n = (long)num_divide(numval, n); break;
-			    case '%': n = (long)num_modulus(numval, n); break;
+			    case '/': n = (long)num_divide(numval, n,
+							       &failed); break;
+			    case '%': n = (long)num_modulus(numval, n,
+							       &failed); break;
 			}
 		    }
 		    else if (opt_type == gov_string