summaryrefslogtreecommitdiff
path: root/src/userfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-11-04 23:39:38 +0100
committerBram Moolenaar <Bram@vim.org>2018-11-04 23:39:38 +0100
commit9e353b5265bd7fa103caf4e5a9b3c99f344f548e (patch)
treef160112f470bdd7d72e902ae6d185ce442e27cc3 /src/userfunc.c
parentba3ff539303c7bb6e46a6802dce3c7b2e55284e0 (diff)
downloadvim-git-9e353b5265bd7fa103caf4e5a9b3c99f344f548e.tar.gz
patch 8.1.0511: ml_get error when calling a function with a rangev8.1.0511
Problem: ml_get error when calling a function with a range. Solution: Don't position the cursor after the last line.
Diffstat (limited to 'src/userfunc.c')
-rw-r--r--src/userfunc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/userfunc.c b/src/userfunc.c
index 7c3b7f673..f79e7f175 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -3149,6 +3149,13 @@ ex_call(exarg_T *eap)
{
if (!eap->skip && eap->addr_count > 0)
{
+ if (lnum > curbuf->b_ml.ml_line_count)
+ {
+ // If the function deleted lines or switched to another buffer
+ // the line number may become invalid.
+ EMSG(_(e_invrange));
+ break;
+ }
curwin->w_cursor.lnum = lnum;
curwin->w_cursor.col = 0;
#ifdef FEAT_VIRTUALEDIT