Skip to content

Commit

Permalink
Null check SparseWrapperStream
Browse files Browse the repository at this point in the history
  • Loading branch information
LTRData committed Nov 11, 2024
1 parent f9ef6c6 commit 7203c25
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Library/DiscUtils.Streams/SparseStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,16 @@ private class SparseWrapperStream : SparseStream

public SparseWrapperStream(Stream wrapped, Ownership ownsWrapped, IEnumerable<StreamExtent> extents)
{
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(wrapped);
_wrapped = wrapped;
#else
_wrapped = wrapped
?? throw new ArgumentNullException(nameof(wrapped));
#endif

_ownsWrapped = ownsWrapped;

if (extents != null)
{
_extents = new List<StreamExtent>(extents);
Expand Down

0 comments on commit 7203c25

Please sign in to comment.