Commit 223524d5 authored by Mikaël Salson's avatar Mikaël Salson Committed by Vidjil Team
Browse files

vidjil_utils: extract_fields_from_json: make sure the value exists before accessing it.

parent 837e80fc
......@@ -175,7 +175,8 @@ def extract_fields_from_json(json_fields, pos_in_list, filename):
matched_keys = {}
for field in json_fields:
value = extract_value_from_json_path(json_fields[field], json_dict)
if not isinstance(value, basestring):
if value is not None:
if not isinstance(value, basestring) and len(value) > pos_in_list:
matched_keys[field] = value[pos_in_list]
matched_keys[field] = value
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment