vim-patch:8.2.0678: rare crash for popup menu

Problem:    Rare crash for popup menu.
Solution:   Check for NULL pointer. (Nobuhiro Takasaki, closes vim/vim#6027)
d58a662f44
This commit is contained in:
Jan Edmund Lazo
2020-05-02 16:23:30 -04:00
parent 560ce25359
commit bc29283f20

View File

@@ -63,10 +63,13 @@ static void pum_compute_size(void)
pum_kind_width = 0; pum_kind_width = 0;
pum_extra_width = 0; pum_extra_width = 0;
for (int i = 0; i < pum_size; i++) { for (int i = 0; i < pum_size; i++) {
int w = vim_strsize(pum_array[i].pum_text); int w;
if (pum_array[i].pum_text != NULL) {
w = vim_strsize(pum_array[i].pum_text);
if (pum_base_width < w) { if (pum_base_width < w) {
pum_base_width = w; pum_base_width = w;
} }
}
if (pum_array[i].pum_kind != NULL) { if (pum_array[i].pum_kind != NULL) {
w = vim_strsize(pum_array[i].pum_kind) + 1; w = vim_strsize(pum_array[i].pum_kind) + 1;
if (pum_kind_width < w) { if (pum_kind_width < w) {