patch 9.0.1595: line pointer becomes invalid when using spell checking

Problem:    Line pointer becomes invalid when using spell checking.
Solution:   Call ml_get() at the right places. (Luuk van Baal, closes #12456)
diff --git a/src/testdir/test_spell.vim b/src/testdir/test_spell.vim
index 350077a..a42d4c7 100644
--- a/src/testdir/test_spell.vim
+++ b/src/testdir/test_spell.vim
@@ -958,6 +958,7 @@
   CheckScreendump
 
   let lines =<< trim END
+       call test_override('alloc_lines', 1)
        call setline(1, [
              \ "This is some text without any spell errors.  Everything",
              \ "should just be black, nothing wrong here.",
@@ -980,6 +981,7 @@
   CheckScreendump
 
   let lines =<< trim END
+       call test_override('alloc_lines', 1)
        call setline(1, [
              \ "   This line has a sepll error. and missing caps and trailing spaces.   ",
              \ "another missing cap here.",
@@ -1019,6 +1021,14 @@
   call term_sendkeys(buf, "\<C-E>\<C-L>")
   call VerifyScreenDump(buf, 'Test_spell_8', {})
 
+  " Adding an empty line does not remove Cap in "mod_bot" area
+  call term_sendkeys(buf, "zbO\<Esc>")
+  call VerifyScreenDump(buf, 'Test_spell_9', {})
+
+  " Multiple empty lines does not remove Cap in the line after
+  call term_sendkeys(buf, "O\<Esc>\<C-L>")
+  call VerifyScreenDump(buf, 'Test_spell_10', {})
+
   " clean up
   call StopVimInTerminal(buf)
 endfunc
@@ -1027,6 +1037,7 @@
   CheckScreendump
 
   let lines =<< trim END
+       call test_override('alloc_lines', 1)
        call setline(1, [
              \ "test "->repeat(20),
              \ "",