diff --git a/bids/layout/index.py b/bids/layout/index.py index 62cbec26..38800d0e 100644 --- a/bids/layout/index.py +++ b/bids/layout/index.py @@ -465,6 +465,10 @@ def create_association_pair(src, dst, kind, kind2=None): # Create Tag <-> Entity mappings, and any newly discovered Entities for md_key, md_val in file_md.items(): + # Treat null entries (deserialized to None) as absent + # Alternative is to cast None to null in layout.models._create_tag_dict + if md_val is None: + continue tag_string = '{}_{}'.format(bf.path, md_key) # Skip pairs that were already found in the filenames if tag_string in all_tags: diff --git a/bids/tests/data/ds005/task-mixedgamblestask_bold.json b/bids/tests/data/ds005/task-mixedgamblestask_bold.json index fb2a2e92..b90b3d6d 100644 --- a/bids/tests/data/ds005/task-mixedgamblestask_bold.json +++ b/bids/tests/data/ds005/task-mixedgamblestask_bold.json @@ -1,5 +1,6 @@ { "RepetitionTime": 2.0, "TaskName": "mixed-gambles task", - "SliceTiming": [0.0, 0.0571, 0.1143, 0.1714, 0.2286, 0.2857] + "SliceTiming": [0.0, 0.0571, 0.1143, 0.1714, 0.2286, 0.2857], + "NullTestMetadata": null }