diff --git a/CHANGELIST.md b/CHANGELIST.md index 5741860a..57b3d2fa 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -10,6 +10,7 @@ - Update to Aaru v5.3.0-rc2 - Add .NET 5.0 as build target - Remove .NET Core 3.1 and .NET 5.0 from AppVeyor build artifacts +- Null-safeguard RedumpLib conversions ### 2.1 (2021-07-22) - Enum, no more diff --git a/RedumpLib/Data/Extensions.cs b/RedumpLib/Data/Extensions.cs index a00dc915..8d14ff98 100644 --- a/RedumpLib/Data/Extensions.cs +++ b/RedumpLib/Data/Extensions.cs @@ -800,7 +800,7 @@ namespace RedumpLib.Data /// Category represented by the string, if possible public static DiscCategory? ToDiscCategory(string category) { - switch (category.ToLowerInvariant()) + switch (category?.ToLowerInvariant()) { case "games": return DiscCategory.Games; @@ -849,7 +849,7 @@ namespace RedumpLib.Data /// DiscType represented by the string, if possible public static DiscType? ToDiscType(string discType) { - switch (discType.ToLowerInvariant()) + switch (discType?.ToLowerInvariant()) { case "bd25": case "bd-25": @@ -1316,7 +1316,7 @@ namespace RedumpLib.Data /// RedumpSystem represented by the string, if possible public static RedumpSystem? ToRedumpSystem(string system) { - switch (system.ToLowerInvariant()) + switch (system?.ToLowerInvariant()) { #region BIOS Sets @@ -2158,7 +2158,7 @@ namespace RedumpLib.Data /// YesNo represented by the string, if possible public static YesNo? ToYesNo(string yesno) { - switch (yesno.ToLowerInvariant()) + switch (yesno?.ToLowerInvariant()) { case "no": return YesNo.No;