mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-07-09 02:16:55 +00:00
Add short-circuit for 0-length arrays
This commit is contained in:
@@ -46,7 +46,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static AACSMediaKeyBlock? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static BDPlusSVM? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static BFPK? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static BSP? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static CFB? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static CHD? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static CIA? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static GCF? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static IRD? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static InstallShieldCabinet? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static LinearExecutable? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static MSDOS? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static MicrosoftCabinet? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static MoPaQ? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -231,7 +231,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static N3DS? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static NCF? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static NewExecutable? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static Nitro? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static PAK? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static PFF? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static PIC? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static PKZIP? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static PlayJAudioFile? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static PlayJPlaylist? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -783,7 +783,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static PortableExecutable? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static Quantum? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static SGA? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static VBSP? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static VPK? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static WAD3? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public static XZP? Create(byte[]? data, int offset)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null)
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
|
||||
// If the offset is out of bounds
|
||||
|
||||
Reference in New Issue
Block a user