From afd6c13c6b77053c04d858bb5e2aa9235fb62024 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 1 Mar 2022 07:35:31 -0500 Subject: [PATCH] Fix infinite loop when summary window contains no sections Resolves: https://github.com/tpope/vim-fugitive/issues/1954 --- autoload/fugitive.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index da58e69..dd09bec 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -4330,7 +4330,7 @@ function! s:Selection(arg1, ...) abort else let last = first endif - while getline(first) =~# '^$\|^[A-Z][a-z]' + while first <= line('$') && getline(first) =~# '^$\|^[A-Z][a-z]' let first += 1 endwhile if first > last || &filetype !=# 'fugitive'