From d29419bcd69432aded1df73cb74853db86daf20d Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 28 Oct 2014 21:55:08 +0000 Subject: Fix invalid memory access when applying modifications on an empty buffer That can happen when undoing/redoing accross a buffer reload boundary. --- src/buffer.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/buffer.cc') diff --git a/src/buffer.cc b/src/buffer.cc index 81804c79..0b0dca1e 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -351,7 +351,9 @@ void Buffer::apply_modification(const Modification& modification) kak_assert(is_valid(coord)); // in modifications, end coords should be {line_count(), 0} - kak_assert(coord != ByteCoord(line_count()-1, m_lines.back().length())); + kak_assert((m_lines.empty() and coord == ByteCoord{0,0} ) or + coord != ByteCoord(line_count()-1, m_lines.back().length())); + switch (modification.type) { case Modification::Insert: -- cgit v1.2.3