Xorg: Handle nil :content value

The `Xorg.find_versions` method was recently updated to replace
`match_data[:content].blank?` with `match_data[:content].empty?` but
this is producing an `undefined method 'empty?' for nil` error, as
`:content` is not present when `PageMatch.find_versions` uses cached
content. This updates `Xorg.find_versions` to handle nil `:content`
values in a way that's similar to other `find_versions` methods.
This commit is contained in:
Sam Ford 2025-03-06 09:56:01 -05:00
parent 1f5448fc65
commit 67c333ec0a
No known key found for this signature in database
GPG Key ID: 7AF5CBEE1DD6F76D

View File

@ -136,9 +136,11 @@ module Homebrew
options:,
&block
)
content = match_data[:content]
return match_data if content.blank?
# Cache any new page content
@page_data[generated_url] = match_data[:content] unless match_data[:content].empty?
@page_data[generated_url] = content unless cached_content
match_data
end