From 87125e2707c37a10d5f081ee11f51111896febc9 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 3 Feb 2015 23:39:04 +0000 Subject: [PATCH] Fix too strict assert and unneeded (lets hope) check --- src/word_db.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/word_db.cc b/src/word_db.cc index 2786396b..4ddc69ee 100644 --- a/src/word_db.cc +++ b/src/word_db.cc @@ -101,7 +101,8 @@ void WordDB::update_db() auto old_line = 0_line; for (auto& modif : modifs) { - kak_assert(0_line <= modif.new_line and modif.new_line < buffer.line_count()); + kak_assert(0_line <= modif.new_line and modif.new_line <= buffer.line_count()); + kak_assert(modif.new_line < buffer.line_count() or modif.num_added == 0); kak_assert(old_line <= modif.old_line); while (old_line < modif.old_line) new_lines.push_back(std::move(m_lines[(int)old_line++])); @@ -116,9 +117,6 @@ void WordDB::update_db() for (auto l = 0_line; l < modif.num_added; ++l) { - if (modif.new_line + l >= buffer.line_count()) - break; - new_lines.push_back(buffer.line_storage(modif.new_line + l)); add_words(get_words(SharedString{new_lines.back()})); }