diff src/spellfile.c @ 29802:be40495e9cd8 v9.0.0240

patch 9.0.0240: crash when using ":mkspell" with an empty .dic file Commit: https://github.com/vim/vim/commit/6669de1b235843968e88844ca6d3c8dec4b01a9e Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 21 20:33:47 2022 +0100 patch 9.0.0240: crash when using ":mkspell" with an empty .dic file Problem: Crash when using ":mkspell" with an empty .dic file. Solution: Check for an empty word tree.
author Bram Moolenaar <Bram@vim.org>
date Sun, 21 Aug 2022 21:45:03 +0200
parents 89e1d67814a9
children e4f23b4244ff
line wrap: on
line diff
--- a/src/spellfile.c
+++ b/src/spellfile.c
@@ -5585,10 +5585,12 @@ sug_filltree(spellinfo_T *spin, slang_T 
 
     /*
      * Go through the whole case-folded tree, soundfold each word and put it
-     * in the trie.
+     * in the trie.  Bail out if the tree is empty.
      */
     byts = slang->sl_fbyts;
     idxs = slang->sl_fidxs;
+    if (byts == NULL || idxs == NULL)
+	return FAIL;
 
     arridx[0] = 0;
     curi[0] = 1;