Skip to content

Commit d4e841f

Browse files
committed
fix: error when COMP_WORDS is empty
Signed-off-by: wxiwnd <[email protected]>
1 parent e2af029 commit d4e841f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

scripts/bash_pinyin_completion

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ _comp_expand_glob() {
3737
}
3838

3939
_pinyin_completion() {
40+
# Check COMP_WORDS existence
41+
if [ ${#COMP_WORDS[@]} -eq 0 ] || [ -z "${COMP_CWORD+x}" ]; then
42+
return
43+
fi
44+
4045
local cur="${COMP_WORDS[COMP_CWORD]}"
4146

4247
# ignore empty

0 commit comments

Comments
 (0)