summaryrefslogtreecommitdiffstats
path: root/src/insexpand.c
diff options
context:
space:
mode:
authorChristian Brabandt <cb@256bit.org>2024-01-29 21:46:58 +0100
committerChristian Brabandt <cb@256bit.org>2024-01-29 21:49:36 +0100
commitfef66301665027f1801a18d796f74584666f41ef (patch)
tree5c60cc93730d095b5dd021fe4355a2a51a7b6b32 /src/insexpand.c
parent6e0a18f82bd04a45e9682523c42af9cbbc37684c (diff)
patch 9.1.0065: Segfault with CompleteChanged autocommandv9.1.0065
Problem: Segfault with CompleteChanged autocommand (markonm ) Solution: Test match->cp_prev for being NULL before accessing it closes: #13929 Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/insexpand.c')
-rw-r--r--src/insexpand.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/insexpand.c b/src/insexpand.c
index e870147012..ba66e51cfb 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -3075,7 +3075,8 @@ info_add_completion_info(list_T *li)
// Skip the element with the CP_ORIGINAL_TEXT flag at the beginning, in case of
// forward completion, or at the end, in case of backward completion.
- match = forward ? match->cp_next : (compl_no_select && match_at_original_text(match) ? match->cp_prev : match->cp_prev->cp_prev);
+ match = forward || match->cp_prev == NULL ? match->cp_next :
+ (compl_no_select && match_at_original_text(match) ? match->cp_prev : match->cp_prev->cp_prev);
while (match != NULL && !match_at_original_text(match))
{