From 75fe0050553a2ead71f1c04de2bfb6c72f800751 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 31 Jan 2024 14:19:45 +0100 Subject: [PATCH] fix: sentry error --- app/Livewire/Team/Invitations.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Livewire/Team/Invitations.php b/app/Livewire/Team/Invitations.php index c51723572..436c0778d 100644 --- a/app/Livewire/Team/Invitations.php +++ b/app/Livewire/Team/Invitations.php @@ -12,7 +12,11 @@ class Invitations extends Component public function deleteInvitation(int $invitation_id) { - TeamInvitation::find($invitation_id)->delete(); + $initiation_found = TeamInvitation::find($invitation_id); + if (!$initiation_found) { + return $this->dispatch('error', 'Invitation not found.'); + } + $initiation_found->delete(); $this->refreshInvitations(); $this->dispatch('success', 'Invitation revoked.'); }