empty lines in csvfile means row has no items in list; check row len first. (#40089)

pull/40194/merge
vigiroux 6 years ago committed by Adam Miller
parent 25a48fb89e
commit 0b3ed626b3

@ -106,7 +106,7 @@ class LookupModule(LookupBase):
creader = CSVReader(f, delimiter=to_native(delimiter), encoding=encoding)
for row in creader:
if row[0] == key:
if len(row) and row[0] == key:
return row[int(col)]
except Exception as e:
raise AnsibleError("csvfile: %s" % to_native(e))

Loading…
Cancel
Save