diff --git a/lib/std/cache_hash.zig b/lib/std/cache_hash.zig index 20d2323370..963614fa6b 100644 --- a/lib/std/cache_hash.zig +++ b/lib/std/cache_hash.zig @@ -349,14 +349,14 @@ pub const CacheHash = struct { /// Writing to the manifest file is the only way that this file can return an /// error. pub fn release(self: *@This()) !void { - debug.assert(self.manifest_file != null); + if (self.manifest_file) |file| { + if (self.manifest_dirty) { + try self.write_manifest(); + } - if (self.manifest_dirty) { - try self.write_manifest(); + file.close(); } - self.manifest_file.?.close(); - for (self.files.items) |*file| { file.deinit(self.alloc); }