Skip to content

Commit 3bd6a8f

Browse files
authored
Merge pull request #628 from AArnott/fixNREOnDisposal
Fix NRE thrown from Channel.Dispose in concurrent conditions
2 parents 4ab7fbf + e8357f6 commit 3bd6a8f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Nerdbank.Streams/MultiplexingStream.Channel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ public void Dispose()
381381
// We can't know whether there is or will be more bytes written to the user's PipeWriter,
382382
// but we need to terminate our reader for their writer as part of reclaiming resources.
383383
// Cancel the pending or next read operation so the reader loop will immediately notice and shutdown.
384-
this.mxStreamIOReader.CancelPendingRead();
384+
this.mxStreamIOReader?.CancelPendingRead();
385385

386386
// Only Complete the reader if our async reader doesn't own it to avoid thread-safety bugs.
387387
PipeReader? mxStreamIOReader = null;

0 commit comments

Comments
 (0)