From ee8606d31f01eed4a3e8efb6d8279fb5b4d2845e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 26 Jul 2022 07:46:19 +0800 Subject: vim-patch:8.1.1424: crash when popup menu is deleted while waiting for char Problem: Crash when popup menu is deleted while waiting for char. Solution: Bail out when pum_array was cleared. https://github.com/vim/vim/commit/5c3fb04623d0260762f1c3c1ba250a407098ff2a --- src/nvim/popupmnu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index 5b1b80935e..fce67437c7 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -1054,7 +1054,10 @@ void pum_show_popupmenu(vimmenu_T *menu) ui_flush(); int c = vgetc(); - if (c == ESC || c == Ctrl_C) { + + // Bail out when typing Esc, CTRL-C or some callback closed the popup + // menu. + if (c == ESC || c == Ctrl_C || pum_array == NULL) { break; } else if (c == CAR || c == NL) { // enter: select current item, if any, and close -- cgit