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
This commit is contained in:
LeRoyce Pearson 2020-04-30 17:04:13 -06:00 committed by Andrew Kelley
parent f13c67bcfe
commit 0fa89dc51d

View File

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