diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-05-13 18:59:22 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-05-13 19:01:27 +0100 |
| commit | 7bc73b7ef9402f81a6bb496b03ba84197f76e642 (patch) | |
| tree | 237affcd7fd4aa9e3db818099e6775c5219d7b9a /src/buffer.inl.hh | |
| parent | 8ab1f58594e35c268d6749af835f439ff714af1a (diff) | |
negative coordinates are invalid
Diffstat (limited to 'src/buffer.inl.hh')
| -rw-r--r-- | src/buffer.inl.hh | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/buffer.inl.hh b/src/buffer.inl.hh index 9cfa2d0f..5375d993 100644 --- a/src/buffer.inl.hh +++ b/src/buffer.inl.hh @@ -52,6 +52,9 @@ inline ByteCount Buffer::offset(ByteCoord c) const inline bool Buffer::is_valid(ByteCoord c) const { + if (c.line < 0 or c.column < 0) + return false; + return (c.line < line_count() and c.column < m_lines[c.line].length()) or (c.line == line_count() - 1 and c.column == m_lines.back().length()) or (c.line == line_count() and c.column == 0); |
