summaryrefslogtreecommitdiffstats
path: root/src/if_tcl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/if_tcl.c')
-rw-r--r--src/if_tcl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/if_tcl.c b/src/if_tcl.c
index d3d4639..eab321b 100644
--- a/src/if_tcl.c
+++ b/src/if_tcl.c
@@ -2012,7 +2012,8 @@ ex_tcldo(exarg_T *eap)
#if (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 5) || TCL_MAJOR_VERSION > 8
|| Tcl_LimitExceeded(tclinfo.interp)
#endif
- || curbuf != was_curbuf)
+ || curbuf != was_curbuf
+ || (linenr_T)rs > curbuf->b_ml.ml_line_count)
break;
line = (char *)Tcl_GetVar(tclinfo.interp, var_line, 0);
if (line)