From fc551de25f56af683470af24d79ad98789bfd265 Mon Sep 17 00:00:00 2001 From: Bob Wezelman Date: Wed, 2 Oct 2024 13:41:30 +0200 Subject: [PATCH] Return empty string when there's no asset --- src/Responsive.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Responsive.php b/src/Responsive.php index 378a4ab..7f10f0e 100644 --- a/src/Responsive.php +++ b/src/Responsive.php @@ -5,6 +5,7 @@ use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; use Statamic\Assets\Asset; +use Statamic\Fields\Value; use Statamic\Statamic; class Responsive @@ -12,10 +13,10 @@ class Responsive public static function handle(mixed ...$arguments): Factory|View|string { $image = $arguments[0]; - $image = get_class($image) === 'Statamic\Fields\Value' ? $image->value() : $image; + $image = $image instanceof Value ? $image->value() : $image; $arguments = $arguments[1] ?? []; - if (! $image) { + if (! $image || !($image instanceof Asset)) { return ''; }