summaryrefslogtreecommitdiff
path: root/plugins/SpellChecker/src/hunspell
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SpellChecker/src/hunspell')
-rw-r--r--plugins/SpellChecker/src/hunspell/csutil.cxx3
-rw-r--r--plugins/SpellChecker/src/hunspell/suggestmgr.cxx5
2 files changed, 6 insertions, 2 deletions
diff --git a/plugins/SpellChecker/src/hunspell/csutil.cxx b/plugins/SpellChecker/src/hunspell/csutil.cxx
index cf24bc06dd..ee78edbc40 100644
--- a/plugins/SpellChecker/src/hunspell/csutil.cxx
+++ b/plugins/SpellChecker/src/hunspell/csutil.cxx
@@ -343,6 +343,9 @@ char * line_uniq(char * text, char breakchar) {
char ** lines;
int linenum = line_tok(text, &lines, breakchar);
int i;
+
+ if (linenum == 0)
+ return NULL;
strcpy(text, lines[0]);
for ( i = 1; i < linenum; i++ ) {
int dup = 0;
diff --git a/plugins/SpellChecker/src/hunspell/suggestmgr.cxx b/plugins/SpellChecker/src/hunspell/suggestmgr.cxx
index d89630849c..843075e62f 100644
--- a/plugins/SpellChecker/src/hunspell/suggestmgr.cxx
+++ b/plugins/SpellChecker/src/hunspell/suggestmgr.cxx
@@ -1578,7 +1578,8 @@ char * SuggestMgr::suggest_morph_for_spelling_error(const char * word)
{
char * p = NULL;
char ** wlst = (char **) calloc(maxSug, sizeof(char *));
- if (!**wlst) return NULL;
+ if (!wlst)
+ return NULL;
// we will use only the first suggestion
for (int i = 0; i < maxSug - 1; i++) wlst[i] = "";
int ns = suggest(&wlst, word, maxSug - 1, NULL);
@@ -1586,7 +1587,7 @@ char * SuggestMgr::suggest_morph_for_spelling_error(const char * word)
p = suggest_morph(wlst[maxSug - 1]);
free(wlst[maxSug - 1]);
}
- if (wlst) free(wlst);
+ free(wlst);
return p;
}
#endif // END OF HUNSPELL_EXPERIMENTAL CODE