From 54f5f46e31239eb63f42a56f6527d82c7cfb9ef1 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 19 Nov 2024 16:44:42 -0800 Subject: [PATCH] Improve check for image existence --- app/Http/Controllers/Components/ComponentsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Components/ComponentsController.php b/app/Http/Controllers/Components/ComponentsController.php index c4d9bcec36..62dc25cf1d 100644 --- a/app/Http/Controllers/Components/ComponentsController.php +++ b/app/Http/Controllers/Components/ComponentsController.php @@ -193,7 +193,7 @@ class ComponentsController extends Controller $this->authorize('delete', $component); // Remove the image if one exists - if (Storage::disk('public')->exists('components/'.$component->image)) { + if ($component->image && Storage::disk('public')->exists('components/' . $component->image)) { try { Storage::disk('public')->delete('components/'.$component->image); } catch (\Exception $e) {