From d10c087539e9285682535d3a2974844c3d0f9a92 Mon Sep 17 00:00:00 2001 From: Jaap Jansma Date: Wed, 4 Jan 2017 11:21:21 +0100 Subject: [PATCH] fixed unit test --- CRM/Contact/BAO/Group.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index 163e97ae65..a238a16dd1 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -1153,8 +1153,10 @@ WHERE id IN $groupIdString // caused the function getGroupsHierarchy with a foreach execution takes // around 2.2 seoonds (2,200 ms). // Changing to a for loop execustion takes around 0.02 seconds (20 ms). - for ($i = 0; $i < count($tree[$group['id']]); $i++) { - self::buildGroupHierarchy($hierarchy, $tree[$group['id'][$i]], $tree, $titleOnly, $spacer, $level + 1); + if (isset($tree[$group['id']]) && is_array($tree[$group['id']])) { + for ($i = 0; $i < count($tree[$group['id']]); $i++) { + self::buildGroupHierarchy($hierarchy, $tree[$group['id'][$i]], $tree, $titleOnly, $spacer, $level + 1); + } } } -- 2.25.1