diff src/testdir/test_textformat.vim @ 18408:50c0a9fb07ae v8.1.2198

patch 8.1.2198: crash when using :center in autocommand Commit: https://github.com/vim/vim/commit/396b7c78c0fd9cd07528963b18c27398491df40d Author: Bram Moolenaar <Bram@vim.org> Date: Mon Oct 21 23:08:59 2019 +0200 patch 8.1.2198: crash when using :center in autocommand Problem: Crash when using :center in autocommand. Solution: Bail out early for an empty line. (Dominique pelle, closes https://github.com/vim/vim/issues/5095)
author Bram Moolenaar <Bram@vim.org>
date Mon, 21 Oct 2019 23:15:03 +0200
parents 5ecac7734184
children bb87c5c1e29b
line wrap: on
line diff
--- a/src/testdir/test_textformat.vim
+++ b/src/testdir/test_textformat.vim
@@ -1,4 +1,7 @@
 " Tests for the various 'formatoptions' settings
+
+source check.vim
+
 func Test_text_format()
   enew!
 
@@ -489,3 +492,20 @@ func Test_format_list_auto()
   bwipe!
   set fo& ai& bs&
 endfunc
+
+func Test_crash_github_issue_5095()
+  CheckFeature autocmd
+
+  " This used to segfault, see https://github.com/vim/vim/issues/5095
+  augroup testing
+    au BufNew x center
+  augroup END
+
+  next! x
+
+  bw
+  augroup testing
+    au!
+  augroup END
+  augroup! testing
+endfunc