From f0ce58a79edbc9c6986e234c04eae6fd86d675c4 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sat, 20 Sep 2025 22:32:54 -0400 Subject: [PATCH] Move two things out of the lock --- .../Wrappers/PortableExecutable.cs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) 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];