From b5da02a413a41dfe5547ba37f656e6feca2605e0 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Tue, 16 Jun 2020 09:01:59 +1000 Subject: [PATCH] Fix issue with building smart groups when is empty --- CRM/Contact/BAO/GroupContactCache.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CRM/Contact/BAO/GroupContactCache.php b/CRM/Contact/BAO/GroupContactCache.php index bd5e4a30fa..8b9487b858 100644 --- a/CRM/Contact/BAO/GroupContactCache.php +++ b/CRM/Contact/BAO/GroupContactCache.php @@ -489,7 +489,9 @@ WHERE id IN ( $groupIDs ) $tempTable = $groupContactsTempTable->getName(); $groupContactsTempTable->createWithColumns('contact_id int, group_id int, UNIQUE UI_contact_group (contact_id,group_id)'); - $contactQueries[] = $sql; + if (!empty($sql)) { + $contactQueries[] = $sql; + } // lets also store the records that are explicitly added to the group // this allows us to skip the group contact LEFT JOIN $contactQueries[] = -- 2.25.1