Fix crash in spell check - thx FeMaster1 :)

Fix #4397
This commit is contained in:
Nikolaj Olsson 2020-10-02 12:35:16 +02:00
parent bf0a7c8e53
commit b89419e2f1

View File

@ -718,7 +718,8 @@ namespace Nikse.SubtitleEdit.Forms
correct = true;
}
}
if (!correct && _wordsIndex < _words.Count - 1 && (_currentParagraph.Text[_words[_wordsIndex + 1].Index - 1] == '-' || _currentParagraph.Text[_words[_wordsIndex + 1].Index - 1] == ''))
if (!correct && _wordsIndex < _words.Count - 1 && _words[_wordsIndex + 1].Index - 1 < _currentParagraph.Text.Length &&
(_currentParagraph.Text[_words[_wordsIndex + 1].Index - 1] == '-' || _currentParagraph.Text[_words[_wordsIndex + 1].Index - 1] == ''))
{
var wordWithDash = _currentWord + "-" + _words[_wordsIndex + 1].Text;
correct = DoSpell(wordWithDash);