Skip to content

Commit fff8d09

Browse files
committed
If len(val_list) is zero val_list[0] will crash, this will now return the empty list
1 parent f8293d1 commit fff8d09

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nxc/parsers/ldap_results.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ def parse_result_attributes(ldap_response):
1818
# If we can't decode the value, we'll just return the bytes
1919
val_decoded = val.__bytes__()
2020
val_list.append(val_decoded)
21-
attribute_map[str(attribute["type"])] = val_list if len(val_list) > 1 else val_list[0]
21+
if len(val_list) == 1:
22+
attribute_map[str(attribute["type"])] = val_list[0]
23+
else:
24+
attribute_map[str(attribute["type"])] = val_list
2225
parsed_response.append(attribute_map)
2326
return parsed_response

0 commit comments

Comments
 (0)