1
0
forked from aniani/vim

patch 8.2.0039: memory access error when "z=" has no suggestions

Problem:    Memory access error when "z=" has no suggestions.
Solution:   Check for negative index.
This commit is contained in:
Bram Moolenaar
2019-12-25 13:55:24 +01:00
parent e9a8d1f9ad
commit 569fea2c31
3 changed files with 5 additions and 4 deletions

View File

@@ -3729,7 +3729,8 @@ cleanup_suggestions(
for (i = keep; i < gap->ga_len; ++i)
vim_free(stp[i].st_word);
gap->ga_len = keep;
return stp[keep - 1].st_score;
if (keep >= 1)
return stp[keep - 1].st_score;
}
return maxscore;
}