Fix error when spell-checking an empty text (#1489831)

pull/164/merge
Aleksander Machniak 11 years ago
parent 5a7b7ce039
commit a54cff4c56

@ -25,6 +25,7 @@ CHANGELOG Roundcube Webmail
- Fix redundant alert message on over-size uploads (#1489817) - Fix redundant alert message on over-size uploads (#1489817)
- Fix next message display after removing a message (#1489800) - Fix next message display after removing a message (#1489800)
- Fix missing Mail-Followup-To header in sent mail (#1489829) - Fix missing Mail-Followup-To header in sent mail (#1489829)
- Fix error when spell-checking an empty text (#1489831)
RELEASE 1.0.0 RELEASE 1.0.0
------------- -------------

@ -289,6 +289,7 @@ this.prepare = function(ignore, no_indicator)
this.cnt_errors_fixed = 0; this.cnt_errors_fixed = 0;
this.cnt_errors = 0; this.cnt_errors = 0;
this.setStateChanged('checking_spell'); this.setStateChanged('checking_spell');
this.orginal_text = '';
if (!no_indicator && this.main_controller) if (!no_indicator && this.main_controller)
this.appendIndicator(this.spell_span); this.appendIndicator(this.spell_span);

@ -56,6 +56,10 @@ class rcube_spellcheck_googie extends rcube_spellcheck_engine
{ {
$this->content = $text; $this->content = $text;
if (empty($text)) {
return $this->matches = array();
}
// spell check uri is configured // spell check uri is configured
$url = rcube::get_instance()->config->get('spellcheck_uri'); $url = rcube::get_instance()->config->get('spellcheck_uri');

@ -37,6 +37,9 @@ if ($learn_word) {
$spellchecker->add_word($data); $spellchecker->add_word($data);
$result = '<?xml version="1.0" encoding="'.RCUBE_CHARSET.'"?><learnwordresult></learnwordresult>'; $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 { else {
$spellchecker->check($data); $spellchecker->check($data);
$result = $spellchecker->get_xml(); $result = $spellchecker->get_xml();

@ -35,7 +35,7 @@ $result['id'] = $request['id'];
$spellchecker = new rcube_spellchecker($lang); $spellchecker = new rcube_spellchecker($lang);
if ($request['method'] == 'checkWords') { if ($request['method'] == 'checkWords') {
$result['result'] = $spellchecker->get_words($data); $result['result'] = empty($data) ? array() : $spellchecker->get_words($data);
} }
else if ($request['method'] == 'getSuggestions') { else if ($request['method'] == 'getSuggestions') {
$result['result'] = $spellchecker->get_suggestions($data); $result['result'] = $spellchecker->get_suggestions($data);

Loading…
Cancel
Save