An exception occurred in ReadOnlySubStream when attempting to set the position to the same value.

This commit is contained in:
Twan van Dongen
2025-03-11 18:57:52 +01:00
2 changed files with 4 additions and 12 deletions

View File

@@ -13,7 +13,7 @@ internal class ReadOnlySubStream : NonDisposingStream
public ReadOnlySubStream(Stream stream, long? origin, long bytesToRead)
: base(stream, throwOnDispose: false)
{
if (origin != null)
if (origin != null && stream.Position != origin.Value)
{
stream.Position = origin.Value;
}
@@ -31,7 +31,7 @@ internal class ReadOnlySubStream : NonDisposingStream
public override void Flush() { }
public override long Length => throw new NotSupportedException();
public override long Length => base.Length;
public override long Position
{