aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/spell.c4
-rw-r--r--src/nvim/testdir/test_spell.vim4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 10cc410e81..880c159ce7 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -5761,7 +5761,9 @@ cleanup_suggestions (
xfree(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;
diff --git a/src/nvim/testdir/test_spell.vim b/src/nvim/testdir/test_spell.vim
index 587d9fc42c..2ec77ca57a 100644
--- a/src/nvim/testdir/test_spell.vim
+++ b/src/nvim/testdir/test_spell.vim
@@ -285,9 +285,7 @@ func Test_spellsuggest_option_number()
\ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
set spell spellsuggest=0
- " FIXME: the following line is currently commented out as it triggers a
- " memory error detected in cleanup_suggestions() by asan or valgrind.
- "call assert_equal("\nSorry, no suggestions", execute('norm z='))
+ call assert_equal("\nSorry, no suggestions", execute('norm z='))
" Unlike z=, function spellsuggest(...) should not be affected by the
" max number of suggestions (2) set by the 'spellsuggest' option.