patch 8.2.4985: PVS warns for possible array underrun

Problem:    PVS warns for possible array underrun.
Solution:   Add a check for a positive value. (closes #10451)
This commit is contained in:
Bram Moolenaar
2022-05-20 14:10:50 +01:00
parent 6dab00aa54
commit 875339b22a
2 changed files with 3 additions and 1 deletions

View File

@ -253,7 +253,7 @@ spell_check(
MAXWLEN + 1);
mi.mi_fwordlen = (int)STRLEN(mi.mi_fword);
if (camel_case)
if (camel_case && mi.mi_fwordlen > 0)
// Introduce a fake word end space into the folded word.
mi.mi_fword[mi.mi_fwordlen - 1] = ' ';