From eaae52edb8c54658cc792cc9a300791c2ef03bad Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 14 Jan 2021 16:26:17 +0000 Subject: [PATCH] tab: return default values on existing, blank install receipt contents. --- Library/Homebrew/tab.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index e7224ed1e8..29c1e7d511 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -58,7 +58,12 @@ class Tab < OpenStruct # Returns the {Tab} for an install receipt at `path`. # Results are cached. def self.from_file(path) - cache.fetch(path) { |p| cache[p] = from_file_content(File.read(p), p) } + cache.fetch(path) do |p| + content = File.read(p) + return empty if content.blank? + + cache[p] = from_file_content(content, p) + end end # Like {from_file}, but bypass the cache.