Fix potential problem with bad hash caching

This commit is contained in:
Timothy Baldridge 2022-06-04 14:26:36 -06:00
parent 971a3ca252
commit 4e631ddd69
2 changed files with 7 additions and 2 deletions

View File

@ -276,7 +276,11 @@ namespace Wabbajack.Common
public static async Task<Hash?> 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)

View File

@ -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);