From d229b23ea66e7ad1cc71945e9eee66cbf0397e6a Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 6 Dec 2022 21:04:08 -0800 Subject: [PATCH] Fix CD-Cops table checks --- BurnOutSharp/ProtectionType/CDDVDCops.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/BurnOutSharp/ProtectionType/CDDVDCops.cs b/BurnOutSharp/ProtectionType/CDDVDCops.cs index f9c10d9b..c4b4fb55 100644 --- a/BurnOutSharp/ProtectionType/CDDVDCops.cs +++ b/BurnOutSharp/ProtectionType/CDDVDCops.cs @@ -70,16 +70,19 @@ namespace BurnOutSharp.ProtectionType return match; // Check the imported-name table - bool importedNameTableEntries = nex.ImportedNameTable.Select(kvp => kvp.Value) + bool importedNameTableEntries = nex.ImportedNameTable? + .Select(kvp => kvp.Value) + .Where(inte => inte.NameString != null) .Select(inte => Encoding.ASCII.GetString(inte.NameString)) - .Any(s => s.Contains("CDCOPS")); + .Any(s => s.Contains("CDCOPS")) ?? false; if (importedNameTableEntries) return "CD-Cops"; // Check the nonresident-name table - bool nonresidentNameTableEntries = nex.NonResidentNameTable + bool nonresidentNameTableEntries = nex.NonResidentNameTable? + .Where(nrnte => nrnte.NameString != null) .Select(nrnte => Encoding.ASCII.GetString(nrnte.NameString)) - .Any(s => s.Contains("CDcops assembly-language DLL")); + .Any(s => s.Contains("CDcops assembly-language DLL")) ?? false; if (nonresidentNameTableEntries) return "CD-Cops";