summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-03-09 23:16:14 +0000
committerMaxime Coste <frrrwww@gmail.com>2016-03-09 23:16:14 +0000
commit90d446b2f41f4210eaf84577cf3db7e9557eed8f (patch)
treeaa39c94c5675b3041f6cb22949c682bc4b958401 /src
parent79782fb903822f7060ce1df3222517b62844e61a (diff)
It can happen during an undo/redo that the buffer be temporarily empty
Fix is_end in that case.
Diffstat (limited to 'src')
-rw-r--r--src/buffer.inl.hh3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/buffer.inl.hh b/src/buffer.inl.hh
index d6af3d4a..8397be33 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)