Improve check for image existence

This commit is contained in:
Marcus Moore 2024-11-19 16:44:42 -08:00
parent 51a0767be9
commit 54f5f46e31
No known key found for this signature in database

View file

@ -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) {