Skip to content

Commit 54f5f46

Browse files
committed
Improve check for image existence
1 parent 51a0767 commit 54f5f46

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/Http/Controllers/Components/ComponentsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function destroy($componentId)
193193
$this->authorize('delete', $component);
194194

195195
// Remove the image if one exists
196-
if (Storage::disk('public')->exists('components/'.$component->image)) {
196+
if ($component->image && Storage::disk('public')->exists('components/' . $component->image)) {
197197
try {
198198
Storage::disk('public')->delete('components/'.$component->image);
199199
} catch (\Exception $e) {

0 commit comments

Comments
 (0)