Skip to content

Commit 3c88b78

Browse files
committed
WriteStream: use libgit2's error when we fail to write to the next stream
1 parent 70d0c3b commit 3c88b78

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

LibGit2Sharp/Core/WriteStream.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ public override void Write(byte[] buffer, int offset, int count)
5353
{
5454
fixed (byte* bufferPtr = &buffer[offset])
5555
{
56-
if (nextStream.write(nextPtr, (IntPtr)bufferPtr, (UIntPtr)count) < 0)
56+
int ret = nextStream.write(nextPtr, (IntPtr)bufferPtr, (UIntPtr)count);
57+
if (ret < 0)
5758
{
58-
throw new LibGit2SharpException("failed to write to next buffer");
59+
Ensure.ZeroResult(ret);
5960
}
6061
}
6162
}

0 commit comments

Comments
 (0)