Do not crash if LDAP group does not exist

This commit is contained in:
Timothée Floure 2019-04-28 17:06:03 +02:00
parent 42c1558714
commit 22d6f1539b

View file

@ -156,7 +156,7 @@ def main
filter = Net::LDAP::Filter.eq('cn', list_name)
matched_ldap_groups = conn.search(base: basetree, filter: filter)
if matched_ldap_groups.empty?
if matched_ldap_groups.nil? || matched_ldap_groups.empty?
# Could not find matching LDAP group
puts 'NOT FOUND'
else