From e9640d2571d2ce37f87474a5eb7c43ff4d8018ae Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Fri, 22 Apr 2016 09:47:12 +0200 Subject: [PATCH] Don't crash the event if Profile not found --- QvitterPlugin.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/QvitterPlugin.php b/QvitterPlugin.php index 742a1ff..c72a1ab 100644 --- a/QvitterPlugin.php +++ b/QvitterPlugin.php @@ -1055,14 +1055,17 @@ class QvitterPlugin extends Plugin { $notif->delete(); - // outputs an activity notice that this notice was deleted - $profile = $notice->getProfile(); - // don't delete if this is a user is being deleted // because that creates an infinite loop of deleting and creating notices... $user_is_deleted = false; - $user = User::getKV('id',$profile->id); - if($user instanceof User && $user->hasRole(Profile_role::DELETED)) { + try { + // outputs an activity notice that this notice was deleted + $profile = $notice->getProfile(); + $user = User::getKV('id',$profile->id); + if($user instanceof User && $user->hasRole(Profile_role::DELETED)) { + $user_is_deleted = true; + } + } catch (NoProfileException $e) { $user_is_deleted = true; }