diff src/evalbuffer.c @ 20120:16460964c304 v8.2.0615

patch 8.2.0615: regexp benchmark stest is old style Commit: https://github.com/vim/vim/commit/ad48e6c1590842ab6d48e6caba3e9250734dae27 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Apr 21 22:19:45 2020 +0200 patch 8.2.0615: regexp benchmark stest is old style Problem: Regexp benchmark stest is old style. Solution: Make it a new style test. Fix using a NULL list. Add more tests. (Yegappan Lakshmanan, closes #5963)
author Bram Moolenaar <Bram@vim.org>
date Tue, 21 Apr 2020 22:30:03 +0200
parents 435726a03481
children 4c317d8c1051
line wrap: on
line diff
--- a/src/evalbuffer.c
+++ b/src/evalbuffer.c
@@ -176,6 +176,13 @@ set_buffer_lines(
     if (lines->v_type == VAR_LIST)
     {
 	l = lines->vval.v_list;
+	if (l == NULL || list_len(l) == 0)
+	{
+	    // set proper return code
+	    if (lnum > curbuf->b_ml.ml_line_count)
+		rettv->vval.v_number = 1;	// FAIL
+	    goto done;
+	}
 	range_list_materialize(l);
 	li = l->lv_first;
     }
@@ -251,6 +258,7 @@ set_buffer_lines(
 	update_topline();
     }
 
+done:
     if (!is_curbuf)
     {
 	curbuf = curbuf_save;