patch 8.1.1890: ml_get error when deleting fold marker

Problem:    Ml_get error when deleting fold marker.
Solution:   Check that the line number is not below the last line.  Adjust the
            fold when deleting the empty line.  (Christian Brabandt,
            closes #4834)
diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim
index dc58795..1d5259f 100644
--- a/src/testdir/test_fold.vim
+++ b/src/testdir/test_fold.vim
@@ -741,3 +741,19 @@
   set foldmethod&
   bwipe!
 endfunc
+
+func Test_fold_delete_with_marker()
+  new
+  call setline(1, ['func Func() {{{1', 'endfunc'])
+  1,2yank
+  new
+  set fdm=marker
+  call setline(1, 'x')
+  normal! Vp
+  normal! zd
+  call assert_equal(['func Func() ', 'endfunc'], getline(1, '$'))
+
+  set fdm&
+  bwipe!
+  bwipe!
+endfunc