From 054ccf76664c357edb6ac20cc141c9e288751c46 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 10 Mar 2022 13:12:08 +0100 Subject: 49820: Fix a crash when completing with combination of -Q and braces minimal reproducer .zshrc: zstyle ':completion:*' completer _oldlist _complete setopt nolistambiguous autoload compinit; compinit compdef _foo foo;_foo() { compadd -Q -- stash@{{0,1}} } --- Src/Zle/compresult.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Src/Zle/compresult.c') diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c index 8b5955819..0fed297b5 100644 --- a/Src/Zle/compresult.c +++ b/Src/Zle/compresult.c @@ -612,9 +612,10 @@ instmatch(Cmatch m, int *scs) int pcs = zlemetacs; l = 0; - for (bp = brbeg, brpos = m->brpl, - bradd = (m->pre ? strlen(m->pre) : 0); - bp; bp = bp->next, brpos++) { + bradd = (m->pre ? strlen(m->pre) : 0); + for (bp = brbeg, brpos = m->brpl; + bp && brpos; + bp = bp->next, brpos++) { zlemetacs = a + *brpos + bradd; pcs = zlemetacs; l = strlen(bp->str); -- cgit 1.4.1