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)