diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-01-29 23:11:25 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-01-29 23:11:25 +0100 |
commit | c593fee0e5e850f7e75be41f5d1751f28892a27f (patch) | |
tree | a6e824414c142e87462da80b0945242fcbbc4ebd /src/if_ruby.c | |
parent | 85b5743d3e69f96882b6124d4b4ebf873ca24707 (diff) | |
download | vim-git-c593fee0e5e850f7e75be41f5d1751f28892a27f.tar.gz |
patch 8.0.0270: may get ml_get error when :rubydo deletes linesv8.0.0270
Problem: May get ml_get error when :rubydo deletes lines or switches to
another buffer. (Nikolai Pavlov, issue #1421)
Solution: Check the buffer and line every time.
Diffstat (limited to 'src/if_ruby.c')
-rw-r--r-- | src/if_ruby.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/if_ruby.c b/src/if_ruby.c index afa27abe2..02b59dd14 100644 --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -783,6 +783,7 @@ void ex_rubydo(exarg_T *eap) { int state; linenr_T i; + buf_T *was_curbuf = curbuf; if (ensure_ruby_initialized()) { @@ -792,6 +793,8 @@ void ex_rubydo(exarg_T *eap) { VALUE line; + if (i > curbuf->b_ml.ml_line_count) + break; line = vim_str2rb_enc_str((char *)ml_get(i)); rb_lastline_set(line); eval_enc_string_protect((char *) eap->arg, &state); @@ -800,6 +803,8 @@ void ex_rubydo(exarg_T *eap) error_print(state); break; } + if (was_curbuf != curbuf) + break; line = rb_lastline_get(); if (!NIL_P(line)) { |