57 lines
1.7 KiB
Diff
57 lines
1.7 KiB
Diff
From 4f1b083be43f351bc107541e7b0c9655a5d2c0bb Mon Sep 17 00:00:00 2001
|
|
From: Bram Moolenaar <Bram@vim.org>
|
|
Date: Mon, 29 Aug 2022 20:45:16 +0100
|
|
Subject: [PATCH] patch 9.0.0322: crash when no errors and 'quickfixtextfunc'
|
|
is set
|
|
|
|
Problem: Crash when no errors and 'quickfixtextfunc' is set.
|
|
Solution: Do not handle errors if there aren't any.
|
|
---
|
|
src/quickfix.c | 2 +-
|
|
src/testdir/test_quickfix.vim | 16 ++++++++++++++++
|
|
2 files changed, 17 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/quickfix.c b/src/quickfix.c
|
|
index f6851ef..edf262c 100644
|
|
--- a/src/quickfix.c
|
|
+++ b/src/quickfix.c
|
|
@@ -4743,7 +4743,7 @@ qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int qf_winid)
|
|
}
|
|
|
|
// Check if there is anything to display
|
|
- if (qfl != NULL)
|
|
+ if (qfl != NULL && qfl->qf_start != NULL)
|
|
{
|
|
char_u dirname[MAXPATHL];
|
|
int invalid_val = FALSE;
|
|
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
|
|
index cf803ca..27bed51 100644
|
|
--- a/src/testdir/test_quickfix.vim
|
|
+++ b/src/testdir/test_quickfix.vim
|
|
@@ -4090,6 +4090,22 @@ func Xgetlist_empty_tests(cchar)
|
|
endif
|
|
endfunc
|
|
|
|
+func Test_empty_list_quickfixtextfunc()
|
|
+ " This was crashing. Can only reproduce by running it in a separate Vim
|
|
+ " instance.
|
|
+ let lines =<< trim END
|
|
+ func s:Func(o)
|
|
+ cgetexpr '0'
|
|
+ endfunc
|
|
+ cope
|
|
+ let &quickfixtextfunc = 's:Func'
|
|
+ cgetfile [ex
|
|
+ END
|
|
+ call writefile(lines, 'Xquickfixtextfunc')
|
|
+ call RunVim([], [], '-e -s -S Xquickfixtextfunc -c qa')
|
|
+ call delete('Xquickfixtextfunc')
|
|
+endfunc
|
|
+
|
|
func Test_getqflist()
|
|
call Xgetlist_empty_tests('c')
|
|
call Xgetlist_empty_tests('l')
|
|
--
|
|
2.33.0
|
|
|