Better Null Exceptions

This commit is contained in:
Deterous
2023-10-27 14:40:33 +13:00
parent e542dcbfd9
commit 7a925c959e
2 changed files with 14 additions and 4 deletions
+6 -2
View File
@@ -10,7 +10,7 @@ namespace LibIRD
public enum Region
{
// Null region
NONE = 0,
NONE = 0x00,
// Japan and Asia
Asia = 0x01, // BLAS/BCAS serials
@@ -162,12 +162,16 @@ namespace LibIRD
/// Generates the UID field
/// </summary>
/// <param name="crc32">Redump ISO CRC32 hash</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
private void GenerateUID(byte[] crc32)
{
// Validate CRC32
if (crc32 == null || crc32.Length != 8)
if (crc32 == null)
throw new ArgumentNullException(nameof(crc32));
if (crc32.Length != 8)
throw new ArgumentException("CRC32 hash must be an byte array of length 8", nameof(crc32));
// Redump ISO CRC32 hash is used as the Unique ID in the IRD
UID = BitConverter.ToUInt32(crc32, 0);
}