patch 9.0.0864: crash when using "!!" without a previous shell command
Problem: Crash when using "!!" without a previous shell command.
Solution: Check "prevcmd" is not NULL. (closes #11487)
diff --git a/src/testdir/test_shell.vim b/src/testdir/test_shell.vim
index 3ac4681..7d91dff 100644
--- a/src/testdir/test_shell.vim
+++ b/src/testdir/test_shell.vim
@@ -282,4 +282,17 @@
let &shell = save_shell
endfunc
+func Test_shell_no_prevcmd()
+ " this doesn't do anything, just check it doesn't crash
+ let after =<< trim END
+ exe "normal !!\<CR>"
+ call writefile([v:errmsg, 'done'], 'Xtestdone')
+ qall!
+ END
+ if RunVim([], after, '--clean')
+ call assert_equal(['E34: No previous command', 'done'], readfile('Xtestdone'))
+ endif
+ call delete('Xtestdone')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab