summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-04-25 09:55:00 +0200
committerAleksander Machniak <alec@alec.pl>2014-04-25 09:55:00 +0200
commita54cff4c569f74f7ec1b2ab8379b7ad1820a8af9 (patch)
tree8b0f9c9eaf39f64f2ab1f1b882744bd4b6bb58a1
parent5a7b7ce039c5bffc370ec79aea5eba6043c908ec (diff)
Fix error when spell-checking an empty text (#1489831)
-rw-r--r--CHANGELOG1
-rw-r--r--program/js/googiespell.js1
-rw-r--r--program/lib/Roundcube/rcube_spellcheck_googie.php4
-rw-r--r--program/steps/utils/spell.inc3
-rw-r--r--program/steps/utils/spell_html.inc2
5 files changed, 10 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 5157c53a3..c1dee21d7 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -25,6 +25,7 @@ CHANGELOG Roundcube Webmail
- Fix redundant alert message on over-size uploads (#1489817)
- Fix next message display after removing a message (#1489800)
- Fix missing Mail-Followup-To header in sent mail (#1489829)
+- Fix error when spell-checking an empty text (#1489831)
RELEASE 1.0.0
-------------
diff --git a/program/js/googiespell.js b/program/js/googiespell.js
index c33c56872..de58b7e87 100644
--- a/program/js/googiespell.js
+++ b/program/js/googiespell.js
@@ -289,6 +289,7 @@ this.prepare = function(ignore, no_indicator)
this.cnt_errors_fixed = 0;
this.cnt_errors = 0;
this.setStateChanged('checking_spell');
+ this.orginal_text = '';
if (!no_indicator && this.main_controller)
this.appendIndicator(this.spell_span);
diff --git a/program/lib/Roundcube/rcube_spellcheck_googie.php b/program/lib/Roundcube/rcube_spellcheck_googie.php
index 3777942a6..f9e450fdd 100644
--- a/program/lib/Roundcube/rcube_spellcheck_googie.php
+++ b/program/lib/Roundcube/rcube_spellcheck_googie.php
@@ -56,6 +56,10 @@ class rcube_spellcheck_googie extends rcube_spellcheck_engine
{
$this->content = $text;
+ if (empty($text)) {
+ return $this->matches = array();
+ }
+
// spell check uri is configured
$url = rcube::get_instance()->config->get('spellcheck_uri');
diff --git a/program/steps/utils/spell.inc b/program/steps/utils/spell.inc
index c8807e32f..696fa6005 100644
--- a/program/steps/utils/spell.inc
+++ b/program/steps/utils/spell.inc
@@ -37,6 +37,9 @@ if ($learn_word) {
$spellchecker->add_word($data);
$result = '<?xml version="1.0" encoding="'.RCUBE_CHARSET.'"?><learnwordresult></learnwordresult>';
}
+else if (empty($data)) {
+ $result = '<?xml version="1.0" encoding="'.RCUBE_CHARSET.'"?><spellresult charschecked="0"></spellresult>';
+}
else {
$spellchecker->check($data);
$result = $spellchecker->get_xml();
diff --git a/program/steps/utils/spell_html.inc b/program/steps/utils/spell_html.inc
index 27b14acef..5935dc13f 100644
--- a/program/steps/utils/spell_html.inc
+++ b/program/steps/utils/spell_html.inc
@@ -35,7 +35,7 @@ $result['id'] = $request['id'];
$spellchecker = new rcube_spellchecker($lang);
if ($request['method'] == 'checkWords') {
- $result['result'] = $spellchecker->get_words($data);
+ $result['result'] = empty($data) ? array() : $spellchecker->get_words($data);
}
else if ($request['method'] == 'getSuggestions') {
$result['result'] = $spellchecker->get_suggestions($data);