From cf8be1ce5466f1005f89e0a49693e6450e280fa3 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Wed, 13 Apr 2011 16:19:40 -0700 Subject: Fixed crash in spellchecking when deleting selections while lagging --- linden/indra/llui/lllineeditor.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'linden/indra/llui/lllineeditor.cpp') diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp index 1d998be..7618985 100644 --- a/linden/indra/llui/lllineeditor.cpp +++ b/linden/indra/llui/lllineeditor.cpp @@ -604,21 +604,24 @@ std::vector LLLineEditor::getMisspelledWordsPositions() { wordEnd++; } - //got a word :D - std::string selectedWord(std::string(text.begin(), - text.end()).substr(wordStart,wordEnd-wordStart)); - if(!glggHunSpell->isSpelledRight(selectedWord)) - { - //misspelled word here, and you have just right clicked on it! - //get the center of this word.. - //S32 center = llround( (wordEnd-wordStart)/2 ) + wordStart; - //turn this cursor position into a pixel pos - //center = findPixelNearestPos(center-getCursor()); + //got a word? -- MC + if (wordStart != wordEnd) + { + std::string selectedWord(std::string(text.begin(), + text.end()).substr(wordStart,wordEnd-wordStart)); + + if(!selectedWord.empty() && !glggHunSpell->isSpelledRight(selectedWord)) + { + //misspelled word here, and you have just right clicked on it! + //get the center of this word.. + //S32 center = llround( (wordEnd-wordStart)/2 ) + wordStart; + //turn this cursor position into a pixel pos + //center = findPixelNearestPos(center-getCursor()); - thePosesOfBadWords.push_back( - wordStart); - thePosesOfBadWords.push_back(wordEnd); + thePosesOfBadWords.push_back(wordStart); + thePosesOfBadWords.push_back(wordEnd); + } } } wordEnd++; @@ -2056,7 +2059,7 @@ void LLLineEditor::drawMisspelled(LLRect background) } } - if (glggHunSpell->getSpellCheckHighlight()) + if (!misspellLocations.empty() && glggHunSpell->getSpellCheckHighlight()) { for (int i =0; i<(int)misspellLocations.size(); i++) { -- cgit v1.1