diff --git a/PathfinderAPI/BaseGameFixes/Performance/ThemeCaching.cs b/PathfinderAPI/BaseGameFixes/Performance/ThemeCaching.cs index ed250b2e..5924a23a 100644 --- a/PathfinderAPI/BaseGameFixes/Performance/ThemeCaching.cs +++ b/PathfinderAPI/BaseGameFixes/Performance/ThemeCaching.cs @@ -131,14 +131,18 @@ internal static bool SwitchToLastCustomTheme(object osObject, OSTheme theme) { if (theme == OSTheme.Custom) { - // just dont question it - var lastTheme = CachedThemes.BackingListHead?.Value; - if (lastTheme != null) + lock (cacheLock) { - if (!lastTheme.Loaded) - lastTheme.Load(true); - lastTheme.ApplyTo((OS)osObject); + // just dont question it + var lastTheme = CachedThemes.BackingListHead?.Value; + if (lastTheme != null) + { + if (!lastTheme.Loaded) + lastTheme.Load(true); + lastTheme.ApplyTo((OS) osObject); + } } + return false; }