Skip to content

Commit 0e3b9f8

Browse files
committed
Merge pull request #1107 from libgit2/cmn/ensure-next-stream
WriteStream: use libgit2's error when we fail to write to the next stream
2 parents 70d0c3b + a6dccd1 commit 0e3b9f8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

LibGit2Sharp/Core/WriteStream.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ public override long Seek(long offset, SeekOrigin origin)
4949

5050
public override void Write(byte[] buffer, int offset, int count)
5151
{
52+
int res;
5253
unsafe
5354
{
5455
fixed (byte* bufferPtr = &buffer[offset])
5556
{
56-
if (nextStream.write(nextPtr, (IntPtr)bufferPtr, (UIntPtr)count) < 0)
57-
{
58-
throw new LibGit2SharpException("failed to write to next buffer");
59-
}
57+
res = nextStream.write(nextPtr, (IntPtr)bufferPtr, (UIntPtr)count);
6058
}
6159
}
60+
61+
Ensure.Int32Result(res);
6262
}
6363
}
6464
}

0 commit comments

Comments
 (0)