From 80b1d88bb07b81f44aac2cb2e9d9fcd739340463 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 12 Dec 2015 23:50:01 +0000 Subject: [PATCH] Fix Buffer::changes_since if we get passed an invalid timestamp --- src/buffer.inl.hh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/buffer.inl.hh b/src/buffer.inl.hh index 887b3e09..cabec9c8 100644 --- a/src/buffer.inl.hh +++ b/src/buffer.inl.hh @@ -91,8 +91,10 @@ inline size_t Buffer::timestamp() const inline ConstArrayView Buffer::changes_since(size_t timestamp) const { - return { m_changes.data() + timestamp, - m_changes.data() + m_changes.size() }; + if (timestamp < m_changes.size()) + return { m_changes.data() + timestamp, + m_changes.data() + m_changes.size() }; + return {}; } inline ByteCoord Buffer::back_coord() const