summaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-01-22 07:42:00 +0100
committerMax Kellermann <max@musicpd.org>2019-01-22 07:42:00 +0100
commitffc36d525535d101c8c2cf5d382899bd7e86853f (patch)
tree3b8da3885d1d033474d56b7fa5d96491e26ed5ea /src/input
parent0126276e2f2097cda2efe2e7d688c2c557cc9638 (diff)
input/buffered: implement seeking to end of file
Previously, a seek to the end of the file would cause an assertion failure in SparseMap::Check() because the given offset was invalid. Closes #453
Diffstat (limited to 'src/input')
-rw-r--r--src/input/BufferedInputStream.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/input/BufferedInputStream.cxx b/src/input/BufferedInputStream.cxx
index 98cd5293c..a5688de47 100644
--- a/src/input/BufferedInputStream.cxx
+++ b/src/input/BufferedInputStream.cxx
@@ -66,6 +66,11 @@ BufferedInputStream::Check()
void
BufferedInputStream::Seek(offset_type new_offset)
{
+ if (new_offset >= size) {
+ offset = size;
+ return;
+ }
+
auto r = buffer.Read(new_offset);
if (r.HasData()) {
/* nice, we already have some data at the desired