Fall back to blank image if alt style has no preview image

This is currently crashing the Rainbow Pool when the Anniversary Techo
would appear, because the asset seems to be missing? The SWF doesn't
seem to exist, nor does its manifest.
This commit is contained in:
Emi Matchu 2024-11-15 20:04:45 -08:00
parent 217d25edab
commit c4a7e7916f

View file

@ -62,11 +62,10 @@ class AltStyle < ApplicationRecord
"#{series_name} #{name}" "#{series_name} #{name}"
end end
EMPTY_IMAGE_URL = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
def preview_image_url def preview_image_url
swf_asset = swf_assets.first # Use the image URL for the first asset. Or, fall back to an empty image.
return nil if swf_asset.nil? swf_assets.first&.image_url || EMPTY_IMAGE_URL
swf_asset.image_url
end end
# Given a list of items, return how they look on this alt style. # Given a list of items, return how they look on this alt style.