Avoid buffer end line in word_db update

This commit is contained in:
Maxime Coste 2014-05-24 14:10:27 +01:00
parent 0aa5c4e779
commit 95200d1de1

View File

@ -92,6 +92,9 @@ void WordDB::update_db()
// add words from new lines // add words from new lines
for (auto l = 0_line; l <= modif.num_added.line; ++l) for (auto l = 0_line; l <= modif.num_added.line; ++l)
{ {
if (modif.new_coord.line + l >= buffer.line_count())
break;
new_lines.push_back(get_words(buffer[modif.new_coord.line + l])); new_lines.push_back(get_words(buffer[modif.new_coord.line + l]));
add_words(m_words, new_lines.back()); add_words(m_words, new_lines.back());
} }