diff --git a/taglib/toolkit/tfilestream.cpp b/taglib/toolkit/tfilestream.cpp index 06aabbd8..989e1d23 100644 --- a/taglib/toolkit/tfilestream.cpp +++ b/taglib/toolkit/tfilestream.cpp @@ -206,9 +206,12 @@ ByteVector FileStream::readBlock(unsigned long length) if(length == 0) return ByteVector(); - const unsigned long streamLength = static_cast(FileStream::length()); - if(length > bufferSize() && length > streamLength) - length = streamLength; + if(length > bufferSize()) { + const unsigned long streamLength = static_cast(FileStream::length()); + if(length > streamLength) { + length = streamLength; + } + } ByteVector buffer(static_cast(length));