From 80cf05eb10ac490f076a61f73ee9522722823c41 Mon Sep 17 00:00:00 2001 From: Sewer 56 Date: Tue, 13 Jun 2023 17:13:53 +0100 Subject: [PATCH] Fixed: Crash in Texture Cache Service --- Riders.Tweakbox/Services/Texture/TextureCacheService.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Riders.Tweakbox/Services/Texture/TextureCacheService.cs b/Riders.Tweakbox/Services/Texture/TextureCacheService.cs index 8278f1c..bc657a0 100644 --- a/Riders.Tweakbox/Services/Texture/TextureCacheService.cs +++ b/Riders.Tweakbox/Services/Texture/TextureCacheService.cs @@ -47,7 +47,9 @@ public TextureCacheService(IO io) /// The raw DDS texture data to cache. public void Store(string filePath, Span data) { - var entry = CollectionsMarshal.GetValueRefOrNullRef(_textureCache, filePath); + if (!_textureCache.TryGetValue(filePath, out var entry)) + entry = new TextureCacheEntry(); + entry.LastWriteTime = File.GetLastWriteTimeUtc(filePath); entry.LastAccessTime = DateTime.UtcNow; if (string.IsNullOrEmpty(entry.Target))