Minor fix to avoid ArgumentOutOfRangeException
authorDavid Schmitt <david@dasz.at>
Wed, 9 Oct 2013 08:36:37 +0000 (10:36 +0200)
committerDavid Schmitt <david@dasz.at>
Wed, 9 Oct 2013 08:36:37 +0000 (10:36 +0200)
When the file is empty, data[0] would throw and swallow the original exception.

mcs/tools/security/sn.cs

index c84505d30ab9a745dd37c4971c575e1698974969..4f6660077050d007c56f426b49c7265bf1271f60 100644 (file)
@@ -126,7 +126,7 @@ namespace Mono.Tools {
                                return new StrongName (data).RSA;
                        }
                        catch {
-                               if (data [0] != 0x30)
+                               if (data.Length == 0 || data [0] != 0x30)
                                        throw;
                                // this could be a PFX file
                                Console.Write ("Enter password for private key (will be visible when typed): ");