Null reference when disposing a Volume class #135

Open
opened 2026-01-29 22:07:13 +00:00 by claunia · 0 comments
Owner

Originally created by @JasonBro on GitHub (Oct 3, 2016).

There's a new bit of code in the SharpCompress.Common.Volume class that causes a null exception when ReaderOptions is null (which it is by default).

Workround: Add a ReaderOptions in the Open(Stream, ReaderOptions) call.

    public void Dispose()
    {
        if (!ReaderOptions.LeaveStreamOpen && !disposed)
        {
            actualStream.Dispose();
            disposed = true;
        }
    }
Originally created by @JasonBro on GitHub (Oct 3, 2016). There's a new bit of code in the SharpCompress.Common.Volume class that causes a null exception when ReaderOptions is null (which it is by default). Workround: Add a ReaderOptions in the Open(Stream, ReaderOptions) call. ``` public void Dispose() { if (!ReaderOptions.LeaveStreamOpen && !disposed) { actualStream.Dispose(); disposed = true; } } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#135