Added null check in constructor.
authorMarc-Andre Ferland <madrang@gmail.com>
Sat, 4 Oct 2014 10:42:31 +0000 (06:42 -0400)
committerMarc-Andre Ferland <madrang@gmail.com>
Sat, 4 Oct 2014 10:42:31 +0000 (06:42 -0400)
Avoid throwing NRE later while using the class.

mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoTools.cs

index d57ce5ae55c1e69d7a444b3568960b11554979be..054038731aec8a6f15ef7c9ece468b1603ae68b9 100644 (file)
@@ -88,6 +88,10 @@ namespace Mono.Security.Cryptography {
                // block size (which isn't their real internal block size)
                public BlockProcessor (ICryptoTransform transform, int blockSize)
                {
+                       if (transform == null)
+                               throw new ArgumentNullException ("transform");
+                       if (blockSize <= 0)
+                               throw new ArgumentOutOfRangeException ("blockSize");
                        this.transform = transform;
                        this.blockSize = blockSize;
                        block = new byte [blockSize];