mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
More unnecessary null checks
This commit is contained in:
@@ -15,7 +15,7 @@ namespace SabreTools.DatFiles
|
|||||||
public Models.Metadata.MetadataFile? ConvertToMetadata(bool ignoreblanks = false)
|
public Models.Metadata.MetadataFile? ConvertToMetadata(bool ignoreblanks = false)
|
||||||
{
|
{
|
||||||
// If we don't have items, we can't do anything
|
// If we don't have items, we can't do anything
|
||||||
if (Items == null || Items.Count == 0)
|
if (Items.Count == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// Create an object to hold the data
|
// Create an object to hold the data
|
||||||
@@ -40,7 +40,7 @@ namespace SabreTools.DatFiles
|
|||||||
public Models.Metadata.MetadataFile? ConvertToMetadataDB(bool ignoreblanks = false)
|
public Models.Metadata.MetadataFile? ConvertToMetadataDB(bool ignoreblanks = false)
|
||||||
{
|
{
|
||||||
// If we don't have items, we can't do anything
|
// If we don't have items, we can't do anything
|
||||||
if (ItemsDB == null)
|
if (ItemsDB.GetItems().Count == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// Create an object to hold the data
|
// Create an object to hold the data
|
||||||
@@ -64,10 +64,6 @@ namespace SabreTools.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private Models.Metadata.Header? ConvertHeader()
|
private Models.Metadata.Header? ConvertHeader()
|
||||||
{
|
{
|
||||||
// If the header is invalid, we can't do anything
|
|
||||||
if (Header == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
// Create an internal header
|
// Create an internal header
|
||||||
var header = Header.GetInternalClone();
|
var header = Header.GetInternalClone();
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ namespace SabreTools.DatTools
|
|||||||
public bool ApplyExtras(DatFile datFile, bool throwOnError = false)
|
public bool ApplyExtras(DatFile datFile, bool throwOnError = false)
|
||||||
{
|
{
|
||||||
// If we have no extras, don't attempt to apply and just return true
|
// If we have no extras, don't attempt to apply and just return true
|
||||||
if (Items == null || Items.Count == 0)
|
if (Items.Count == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var watch = new InternalStopwatch("Applying extra mappings to DAT");
|
var watch = new InternalStopwatch("Applying extra mappings to DAT");
|
||||||
@@ -150,7 +150,7 @@ namespace SabreTools.DatTools
|
|||||||
public bool ApplyExtrasDB(DatFile datFile, bool throwOnError = false)
|
public bool ApplyExtrasDB(DatFile datFile, bool throwOnError = false)
|
||||||
{
|
{
|
||||||
// If we have no extras, don't attempt to apply and just return true
|
// If we have no extras, don't attempt to apply and just return true
|
||||||
if (Items == null || Items.Count == 0)
|
if (Items.Count == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var watch = new InternalStopwatch("Applying extra mappings to DAT");
|
var watch = new InternalStopwatch("Applying extra mappings to DAT");
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ namespace SabreTools.DatTools
|
|||||||
public void SetFields(DatHeader datHeader)
|
public void SetFields(DatHeader datHeader)
|
||||||
{
|
{
|
||||||
// If we have an invalid input, return
|
// If we have an invalid input, return
|
||||||
if (datHeader == null || HeaderFieldMappings.Count == 0)
|
if (HeaderFieldMappings.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var kvp in HeaderFieldMappings)
|
foreach (var kvp in HeaderFieldMappings)
|
||||||
|
|||||||
Reference in New Issue
Block a user