We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 09dc86e commit 4a0ddd1Copy full SHA for 4a0ddd1
LibGit2Sharp/Core/GitBufWriteStream.cs
@@ -19,20 +19,19 @@ internal GitBufWriteStream(IntPtr gitBufPointer)
19
20
protected override void Dispose(bool disposing)
21
{
22
- using (var gitBuf = gitBufPointer.MarshalAs<GitBuf>())
23
- WriteTo(gitBuf);
+ if (base.CanSeek) // False if stream has already been written/closed
+ {
24
+ using (var gitBuf = gitBufPointer.MarshalAs<GitBuf>())
25
26
+ WriteTo(gitBuf);
27
+ }
28
29
30
base.Dispose(disposing);
31
}
32
33
private void WriteTo(GitBuf gitBuf)
34
- if (!base.CanSeek)
- {
- // Already closed; already written
- return;
- }
35
-
36
Seek(0, SeekOrigin.Begin);
37
38
var length = (int)Length;
0 commit comments