From 90d446b2f41f4210eaf84577cf3db7e9557eed8f Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 9 Mar 2016 23:16:14 +0000 Subject: [PATCH] It can happen during an undo/redo that the buffer be temporarily empty Fix is_end in that case. --- src/buffer.inl.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/buffer.inl.hh b/src/buffer.inl.hh index d6af3d4af..8397be336 100644 --- a/src/buffer.inl.hh +++ b/src/buffer.inl.hh @@ -104,7 +104,8 @@ inline ByteCoord Buffer::back_coord() const inline ByteCoord Buffer::end_coord() const { - return { line_count() - 1, m_lines.back().length() }; + return m_lines.empty() ? + ByteCoord{0,0} : ByteCoord{ line_count() - 1, m_lines.back().length() }; } inline BufferIterator::BufferIterator(const Buffer& buffer, ByteCoord coord)