diff --git a/SabreTools.Serialization/Wrappers/PortableExecutable.cs b/SabreTools.Serialization/Wrappers/PortableExecutable.cs index f1250d13..721711f3 100644 --- a/SabreTools.Serialization/Wrappers/PortableExecutable.cs +++ b/SabreTools.Serialization/Wrappers/PortableExecutable.cs @@ -2029,22 +2029,19 @@ namespace SabreTools.Serialization.Wrappers /// Section strings on success, null on error public List? GetSectionStrings(int index) { + // If we have no sections + if (SectionNames.Length == 0 || SectionTable == null || SectionTable.Length == 0) + return null; + + // If the section doesn't exist + if (index < 0 || index >= SectionTable.Length) + return null; + lock (_sectionStringDataLock) { - // If we have no sections - if (SectionNames.Length == 0 || SectionTable == null || SectionTable.Length == 0) - { - _sectionStringData = []; - return null; - } - // Create the section string array if we have to _sectionStringData ??= new List?[SectionNames.Length]; - // If the section doesn't exist - if (index < 0 || index >= SectionTable.Length) - return null; - // If we already have cached data, just use that immediately if (_sectionStringData[index] != null) return _sectionStringData[index];