Commit be69e8e871

LeRoyce Pearson <leroycepearson@geemili.xyz>
2020-05-01 03:54:40
Remove non-null assertion in `CacheHash.release()`
People using the API as intended would never trigger this assertion anyway, but if someone has a non standard use case, I see no reason to make the program panic.
1 parent e6a37ed
Changed files (1)
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);
         }