patch 9.1.0471: Crash when using autocmd_get() after removing event inside autocmd
Problem: Crash when using autocmd_get() after removing event inside
autocmd (Sergey Vlasov)
Solution: Check that the pattern is NULL (zeertzjq).
fixes: #14937
closes: #14939
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/autocmd.c b/src/autocmd.c
index bce57cb..8380f8a 100644
--- a/src/autocmd.c
+++ b/src/autocmd.c
@@ -3391,6 +3391,9 @@
{
char_u *group_name;
+ if (ap->pat == NULL) // pattern has been removed
+ continue;
+
if (group != AUGROUP_ALL && group != ap->group)
continue;