From 0fa89dc51d6bb92f36ceb1399e07aa6f7c1dbd2b Mon Sep 17 00:00:00 2001 From: LeRoyce Pearson Date: Thu, 30 Apr 2020 17:04:13 -0600 Subject: [PATCH] Fix read from null pointer in CacheHash.hit It occured when the manifest file was manually edited to include an extra file. Now it will simply copy the file name in the manifest file --- lib/std/cache_hash.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/std/cache_hash.zig b/lib/std/cache_hash.zig index 6b3d6d7ba24f6d14f3ee943e0aad1b1d8bc3de1c..aa7ae6896d5702aaedf3648fdea0e11b3e74e64c 100644 --- a/lib/std/cache_hash.zig +++ b/lib/std/cache_hash.zig @@ -186,6 +186,10 @@ pub const CacheHash = struct { return error.InvalidFormat; } + if (cache_hash_file.path == null) { + cache_hash_file.path = try mem.dupe(self.alloc, u8, file_path); + } + const this_file = fs.cwd().openFile(cache_hash_file.path.?, .{ .read = true }) catch { return error.CacheUnavailable; }; -- 2.54.0