[Filter] Add null checks on filter; attempt to find crash

This commit is contained in:
Matt Nadareski
2017-01-12 14:15:30 -08:00
parent dc5f755150
commit 57ed8cef30

View File

@@ -118,6 +118,18 @@ namespace SabreTools.Helper.Dats
/// <returns>True if the file passed the filter, false otherwise</returns> /// <returns>True if the file passed the filter, false otherwise</returns>
public bool ItemPasses(DatItem item, Logger logger) public bool ItemPasses(DatItem item, Logger logger)
{ {
// If the item is null, we automatically fail it
if (item == null)
{
return false;
}
// If the item's machine is null, we automatically fail it
if (item.Machine == null)
{
return false;
}
// Filter on machine type // Filter on machine type
if (_machineTypes != MachineType.NULL && (item.Machine.MachineType & _machineTypes) == 0) if (_machineTypes != MachineType.NULL && (item.Machine.MachineType & _machineTypes) == 0)
{ {