Skip to content

Commit

Permalink
Merge PR #432: Throw ArgumentNullException in BZip2
Browse files Browse the repository at this point in the history
Change the BZip2 Compress/Decompress functions to throw ArgumentNullxception rather than Exception when null stream parameters are provided
  • Loading branch information
Numpsy authored Apr 13, 2020
1 parent 9df6f42 commit f36ca37
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/ICSharpCode.SharpZipLib/BZip2/BZip2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ public static class BZip2
/// <param name="isStreamOwner">Both streams are closed on completion if true.</param>
public static void Decompress(Stream inStream, Stream outStream, bool isStreamOwner)
{
if (inStream == null || outStream == null)
{
throw new Exception("Null Stream");
}
if (inStream == null)
throw new ArgumentNullException(nameof(inStream));

if (outStream == null)
throw new ArgumentNullException(nameof(outStream));

try
{
Expand Down Expand Up @@ -51,10 +52,11 @@ public static void Decompress(Stream inStream, Stream outStream, bool isStreamOw
/// the lowest compression and 9 the highest.</param>
public static void Compress(Stream inStream, Stream outStream, bool isStreamOwner, int level)
{
if (inStream == null || outStream == null)
{
throw new Exception("Null Stream");
}
if (inStream == null)
throw new ArgumentNullException(nameof(inStream));

if (outStream == null)
throw new ArgumentNullException(nameof(outStream));

try
{
Expand Down

0 comments on commit f36ca37

Please sign in to comment.