patch 8.0.1750: crash when clearing loccation list in autocommand
Problem: Crash when clearing loccation list in autocommand.
Solution: Check if "qi" equals "ql_info". (Yegappan Lakshmanan)
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index b0e14e6..12bfe32 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -3175,3 +3175,17 @@
call delete('Xtest2.txt')
call setqflist([], 'f')
endfunc
+
+" The following test used to crash Vim
+func Test_lhelpgrep_autocmd()
+ lhelpgrep quickfix
+ autocmd QuickFixCmdPost * call setloclist(0, [], 'f')
+ lhelpgrep buffer
+ call assert_equal('help', &filetype)
+ call assert_equal(0, getloclist(0, {'nr' : '$'}).nr)
+ lhelpgrep tabpage
+ call assert_equal('help', &filetype)
+ call assert_equal(1, getloclist(0, {'nr' : '$'}).nr)
+ au! QuickFixCmdPost
+ new | only
+endfunc