From f0a8a496df50c7a631eb65e8c8ecf60940225156 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 19 Mar 2018 12:05:19 +1300 Subject: [PATCH] Use try catch when deleting groups (dev/core/issues/22 ) --- CRM/Group/Form/Edit.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CRM/Group/Form/Edit.php b/CRM/Group/Form/Edit.php index 0ef2b90b1f..8c286116e9 100644 --- a/CRM/Group/Form/Edit.php +++ b/CRM/Group/Form/Edit.php @@ -106,7 +106,12 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { if ($this->_action == CRM_Core_Action::DELETE) { if (isset($this->_id)) { $this->assign('title', $this->_title); - $this->assign('count', CRM_Contact_BAO_Group::memberCount($this->_id)); + try { + $this->assign('count', CRM_Contact_BAO_Group::memberCount($this->_id)); + } + catch (CRM_Core_Exception $e) { + // If the group is borked the query might fail but delete should be possible. + } CRM_Utils_System::setTitle(ts('Confirm Group Delete')); } if ($this->_groupValues['is_reserved'] == 1 && !CRM_Core_Permission::check('administer reserved groups')) { -- 2.25.1