Null-safeguard RedumpLib conversions

This commit is contained in:
Matt Nadareski
2021-09-28 11:58:11 -07:00
parent 2077d53964
commit 52801ee94c
2 changed files with 5 additions and 4 deletions

View File

@@ -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

View File

@@ -800,7 +800,7 @@ namespace RedumpLib.Data
/// <returns>Category represented by the string, if possible</returns>
public static DiscCategory? ToDiscCategory(string category)
{
switch (category.ToLowerInvariant())
switch (category?.ToLowerInvariant())
{
case "games":
return DiscCategory.Games;
@@ -849,7 +849,7 @@ namespace RedumpLib.Data
/// <returns>DiscType represented by the string, if possible</returns>
public static DiscType? ToDiscType(string discType)
{
switch (discType.ToLowerInvariant())
switch (discType?.ToLowerInvariant())
{
case "bd25":
case "bd-25":
@@ -1316,7 +1316,7 @@ namespace RedumpLib.Data
/// <returns>RedumpSystem represented by the string, if possible</returns>
public static RedumpSystem? ToRedumpSystem(string system)
{
switch (system.ToLowerInvariant())
switch (system?.ToLowerInvariant())
{
#region BIOS Sets
@@ -2158,7 +2158,7 @@ namespace RedumpLib.Data
/// <returns>YesNo represented by the string, if possible</returns>
public static YesNo? ToYesNo(string yesno)
{
switch (yesno.ToLowerInvariant())
switch (yesno?.ToLowerInvariant())
{
case "no":
return YesNo.No;