From c4a7e7916f01aac823f612824863194013b12325 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Fri, 15 Nov 2024 20:04:45 -0800 Subject: [PATCH] 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. --- app/models/alt_style.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/models/alt_style.rb b/app/models/alt_style.rb index 941d9187..24fec40d 100644 --- a/app/models/alt_style.rb +++ b/app/models/alt_style.rb @@ -62,11 +62,10 @@ class AltStyle < ApplicationRecord "#{series_name} #{name}" end + EMPTY_IMAGE_URL = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" def preview_image_url - swf_asset = swf_assets.first - return nil if swf_asset.nil? - - swf_asset.image_url + # Use the image URL for the first asset. Or, fall back to an empty image. + swf_assets.first&.image_url || EMPTY_IMAGE_URL end # Given a list of items, return how they look on this alt style.