diff --git a/BurnOutSharp/ProtectionType/LaserLok.cs b/BurnOutSharp/ProtectionType/LaserLok.cs index 1ddd64f8..b75ed3e8 100644 --- a/BurnOutSharp/ProtectionType/LaserLok.cs +++ b/BurnOutSharp/ProtectionType/LaserLok.cs @@ -5,7 +5,6 @@ using System.IO; using System.Linq; using BurnOutSharp.Interfaces; using BurnOutSharp.Matching; -using BurnOutSharp.Tools; using BurnOutSharp.Wrappers; namespace BurnOutSharp.ProtectionType @@ -93,6 +92,12 @@ namespace BurnOutSharp.ProtectionType }; containsCheck2 = pex.GetFirstSectionData(".text").FirstPosition(check2, out position2); } + else + { + // Otherwise, we reset the containsCheck2 value + containsCheck2 = false; + + } if (containsCheck && containsCheck2) return $"LaserLok {GetVersion(pex.GetFirstSectionData(".text"), position2)} {GetBuild(pex.GetFirstSectionData(".text"), true)} [Check disc for physical ring]" + (includeDebug ? $" (Index {position}, {position2})" : string.Empty); @@ -184,6 +189,10 @@ namespace BurnOutSharp.ProtectionType private static string GetVersion(byte[] sectionContent, int position) { + // If we have invalid data + if (sectionContent == null) + return null; + return new string(new ArraySegment(sectionContent, position + 76, 4).Select(b => (char)b).ToArray()); }