patch 8.2.1888: Vim9: getbufline(-1, 1, '$') gives an error

Problem:    Vim9: Getbufline(-1, 1, '$') gives an error.
Solution:   Return an empty list. (closes #7180)
diff --git a/src/evalbuffer.c b/src/evalbuffer.c
index 34155b9..eabe626 100644
--- a/src/evalbuffer.c
+++ b/src/evalbuffer.c
@@ -717,17 +717,19 @@
     void
 f_getbufline(typval_T *argvars, typval_T *rettv)
 {
-    linenr_T	lnum;
-    linenr_T	end;
+    linenr_T	lnum = 1;
+    linenr_T	end = 1;
     buf_T	*buf;
 
     buf = tv_get_buf_from_arg(&argvars[0]);
-
-    lnum = tv_get_lnum_buf(&argvars[1], buf);
-    if (argvars[2].v_type == VAR_UNKNOWN)
-	end = lnum;
-    else
-	end = tv_get_lnum_buf(&argvars[2], buf);
+    if (buf != NULL)
+    {
+	lnum = tv_get_lnum_buf(&argvars[1], buf);
+	if (argvars[2].v_type == VAR_UNKNOWN)
+	    end = lnum;
+	else
+	    end = tv_get_lnum_buf(&argvars[2], buf);
+    }
 
     get_buffer_lines(buf, lnum, end, TRUE, rettv);
 }
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim
index e3d7bb6..d6891a8 100644
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -242,6 +242,8 @@
   var lines = ['aaa', 'bbb', 'ccc']
   setbufline(buf, 1, lines)
   getbufline('#', 1, '$')->assert_equal(lines)
+  getbufline(-1, '$', '$')->assert_equal([])
+  getbufline(-1, 1, '$')->assert_equal([])
 
   bwipe!
 enddef
diff --git a/src/version.c b/src/version.c
index 16e7a9f..04bc248 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1888,
+/**/
     1887,
 /**/
     1886,