mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Reduce implicit null checks
This commit is contained in:
@@ -178,15 +178,22 @@ namespace SabreTools.Serialization
|
||||
/// <summary>
|
||||
/// Convert from <cref="Models.RomCenter.MetadataFile"/> to <cref="Models.Internal.MetadataFile"/>
|
||||
/// </summary>
|
||||
public static Models.Internal.MetadataFile ConvertToInternalModel(MetadataFile item)
|
||||
public static Models.Internal.MetadataFile? ConvertToInternalModel(MetadataFile? item)
|
||||
{
|
||||
if (item == null)
|
||||
return null;
|
||||
|
||||
var metadataFile = new Models.Internal.MetadataFile
|
||||
{
|
||||
[Models.Internal.MetadataFile.HeaderKey] = ConvertHeaderToInternalModel(item),
|
||||
};
|
||||
|
||||
if (item?.Games?.Rom != null && item.Games.Rom.Any())
|
||||
metadataFile[Models.Internal.MetadataFile.MachineKey] = item.Games.Rom.Select(ConvertMachineToInternalModel).ToArray();
|
||||
{
|
||||
metadataFile[Models.Internal.MetadataFile.MachineKey] = item.Games.Rom
|
||||
.Where(r => r != null)
|
||||
.Select(ConvertMachineToInternalModel).ToArray();
|
||||
}
|
||||
|
||||
return metadataFile;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user