From 4e631ddd69aafaaddbd907dd9febfcd3b8b53508 Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Sat, 4 Jun 2022 14:26:36 -0600 Subject: [PATCH] Fix potential problem with bad hash caching --- Wabbajack.Common/Hash.cs | 6 +++++- Wabbajack.Lib/MO2Installer.cs | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Wabbajack.Common/Hash.cs b/Wabbajack.Common/Hash.cs index 44780108..c961f2fd 100644 --- a/Wabbajack.Common/Hash.cs +++ b/Wabbajack.Common/Hash.cs @@ -276,7 +276,11 @@ namespace Wabbajack.Common public static async Task FileHashCachedAsync(this AbsolutePath file) { - if (TryGetHashCache(file, out var foundHash)) return foundHash; + if (TryGetHashCache(file, out var foundHash)) + { + if (foundHash != default) + return foundHash; + } var hash = await file.FileHashAsync(); if (hash != null && hash != Hash.Empty) diff --git a/Wabbajack.Lib/MO2Installer.cs b/Wabbajack.Lib/MO2Installer.cs index 55f478b9..7a7b8b92 100644 --- a/Wabbajack.Lib/MO2Installer.cs +++ b/Wabbajack.Lib/MO2Installer.cs @@ -346,7 +346,8 @@ namespace Wabbajack.Lib await sourceDir.DeleteDirectory(); // Write the expected hash so we ignore compression changes - OutputFolder.Combine(bsa.To).FileHashWriteCache(bsa.Hash); + if (bsa.Hash != default) + OutputFolder.Combine(bsa.To).FileHashWriteCache(bsa.Hash); if (UseCompression) await OutputFolder.Combine(bsa.To).Compact(FileCompaction.Algorithm.XPRESS16K);