summaryrefslogtreecommitdiffstats
path: root/src/if_py_both.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/if_py_both.h')
-rw-r--r--src/if_py_both.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h
index 42db5101d8..3e5993bb64 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -6136,7 +6136,8 @@ run_do(const char *cmd, void *arg UNUSED
goto err;
// Check that the command didn't switch to another buffer.
- if (curbuf != was_curbuf)
+ // Check the line number, the command my have deleted lines.
+ if (curbuf != was_curbuf || lnum > curbuf->b_ml.ml_line_count)
{
Py_XDECREF(ret);
goto err;