From 3c1b48ff18e861080cc70916a9400fdb98115c30 Mon Sep 17 00:00:00 2001 From: AnimatedSwine37 <24914353+AnimatedSwine37@users.noreply.github.com> Date: Sat, 23 Sep 2023 12:12:35 +1000 Subject: [PATCH] Fix cached files not being updated when one mod registers multiple --- Persona.Merger.Common/Cache/MergedFileCache.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Persona.Merger.Common/Cache/MergedFileCache.cs b/Persona.Merger.Common/Cache/MergedFileCache.cs index fa695f3..f808096 100644 --- a/Persona.Merger.Common/Cache/MergedFileCache.cs +++ b/Persona.Merger.Common/Cache/MergedFileCache.cs @@ -62,9 +62,9 @@ public unsafe bool TryGet(string key, Span sources, [MaybeNull cachedPath = null; if (!KeyToFile.TryGetValue(key, out var value)) return false; - - // Note: Checking length of 2 collections is not necessary, key uses character invalid - // in modIds, and thus should never have collisions where source count would be different. + + if (sources.Length != value.Sources.Length) + return false; // We write it this way however to elide bounds checks. fixed (CachedFileSource* currentValueSource = &value.Sources[0])