dev/core#4703 edit with no parents crash
authorSamuel Vanhove <samuel@symbiotic.coop>
Wed, 18 Oct 2023 21:59:59 +0000 (17:59 -0400)
committerSeamus Lee <seamuslee001@gmail.com>
Tue, 24 Oct 2023 01:19:06 +0000 (12:19 +1100)
CRM/Group/Form/Edit.php

index 7f615f322ec8de19a92a1120267dbe87970cc2fa..ebc9dd8a882091dd21c9a409f2e3040a4ef9b40d 100644 (file)
@@ -412,7 +412,9 @@ WHERE  title = %1
     if (isset($form->_id)) {
       $potentialParentGroupIds = CRM_Contact_BAO_GroupNestingCache::getPotentialCandidates($form->_id, $groupNames);
       // put back current groups because they are selected by default
-      $potentialParentGroupIds = array_merge($potentialParentGroupIds, $parentGroupIds);
+      if (!empty($parentGroupIds)) {
+        $potentialParentGroupIds = array_merge($potentialParentGroupIds, $parentGroupIds);
+      }
     }
     else {
       $potentialParentGroupIds = array_keys($groupNames);