diff --git a/modules/ldap/lib/Auth/Process/AttributeAddUsersGroups.php b/modules/ldap/lib/Auth/Process/AttributeAddUsersGroups.php
index 6453db2aa3f016239edfc1cb1a95b131bb594ae7..33fb3919441d00b5eac31d7f70dd953e8e6a9ba5 100644
--- a/modules/ldap/lib/Auth/Process/AttributeAddUsersGroups.php
+++ b/modules/ldap/lib/Auth/Process/AttributeAddUsersGroups.php
@@ -263,7 +263,7 @@ class sspmod_ldap_Auth_Process_AttributeAddUsersGroups extends sspmod_ldap_Auth_
             $groups[] = $dn;
 
             // Recursively search "sub" groups
-            if (is_array($attributes[$map['memberof']])) {
+            if (!empty($attributes[$map['memberof']])) {
                 $groups = array_merge($groups, $this->search($attributes[$map['memberof']]));
             }
         }