fix BufferIterator::offset

This commit is contained in:
Maxime Coste 2013-03-29 19:28:57 +01:00
parent 02826ff2ca
commit 8b821205da

View File

@ -78,7 +78,8 @@ inline char BufferIterator::operator*() const
inline ByteCount BufferIterator::offset() const
{
assert(m_buffer);
return m_buffer->m_lines[line()].start + column();
return line() >= m_buffer->line_count() ?
m_buffer->character_count() : m_buffer->m_lines[line()].start + column();
}
inline size_t BufferIterator::operator-(const BufferIterator& iterator) const