patch 8.2.1787: crash with 'incsearch' and very long line

Problem:    Crash with 'incsearch' and very long line.
Solution:   Check whether regprog becomes NULL. (closes #7063)
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index e39458f..f62914e 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -964,6 +964,20 @@
   call Incsearch_cleanup()
 endfunc
 
+func Test_incsearch_substitute_long_line()
+  new
+  call test_override("char_avail", 1)
+  set incsearch
+
+  call repeat('x', 100000)->setline(1)
+  call feedkeys(':s/\%c', 'xt')
+  redraw
+  call feedkeys("\<Esc>", 'xt')
+
+  call Incsearch_cleanup()
+  bwipe!
+endfunc
+
 " Similar to Test_incsearch_substitute() but with a screendump halfway.
 func Test_incsearch_substitute_dump()
   CheckOption incsearch