It can happen during an undo/redo that the buffer be temporarily empty

Fix is_end in that case.
This commit is contained in:
Maxime Coste 2016-03-09 23:16:14 +00:00
parent 79782fb903
commit 90d446b2f4

View File

@ -104,7 +104,8 @@ inline ByteCoord Buffer::back_coord() const
inline ByteCoord Buffer::end_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) inline BufferIterator::BufferIterator(const Buffer& buffer, ByteCoord coord)