From e408e8c35b8100b9a9d0cb3611b1b95ea2c09505 Mon Sep 17 00:00:00 2001 From: Beliy Nikita Date: Wed, 9 Nov 2022 14:32:12 +0100 Subject: [PATCH 1/3] Added condition to test is IntendedFor file was indexed (issue 470) --- +bids/layout.m | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/+bids/layout.m b/+bids/layout.m index 1908aca9..9fa028de 100644 --- a/+bids/layout.m +++ b/+bids/layout.m @@ -595,12 +595,13 @@ continue end info_dest = bids.internal.return_file_info(BIDS, dest); - try - BIDS.subjects(info_dest.sub_idx).(info_dest.modality)(info_dest.file_idx) ... - .dependencies.explicit{end + 1, 1} = file_list{iFile}; - catch ME - warning('This may fail if your dataset is not valid.'); - rethrow(ME); + if isempty(info_dest.file_idx) + msg = ['IntendedFor file ' dest ' from ' file.filename ' not indexed']; + bids.internal.error_handling(mfilename, 'IntendedForMissing', msg, tolerant, verbose); + continue; + end + BIDS.subjects(info_dest.sub_idx).(info_dest.modality)(info_dest.file_idx) ... + .dependencies.explicit{end + 1, 1} = file_list{iFile}; end end From d68a41664450c28bc02754950a60bed1dbdab3da Mon Sep 17 00:00:00 2001 From: Beliy Nikita Date: Wed, 9 Nov 2022 14:48:31 +0100 Subject: [PATCH 2/3] Fixed extra end statement --- +bids/layout.m | 1 - 1 file changed, 1 deletion(-) diff --git a/+bids/layout.m b/+bids/layout.m index 9fa028de..e04ed490 100644 --- a/+bids/layout.m +++ b/+bids/layout.m @@ -602,7 +602,6 @@ end BIDS.subjects(info_dest.sub_idx).(info_dest.modality)(info_dest.file_idx) ... .dependencies.explicit{end + 1, 1} = file_list{iFile}; - end end end From 8452eb7b2f0f1e2ba41db6d2f4dd61c01f30ac69 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 9 Nov 2022 13:51:45 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- +bids/layout.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/+bids/layout.m b/+bids/layout.m index e04ed490..87132c18 100644 --- a/+bids/layout.m +++ b/+bids/layout.m @@ -598,7 +598,7 @@ if isempty(info_dest.file_idx) msg = ['IntendedFor file ' dest ' from ' file.filename ' not indexed']; bids.internal.error_handling(mfilename, 'IntendedForMissing', msg, tolerant, verbose); - continue; + continue end BIDS.subjects(info_dest.sub_idx).(info_dest.modality)(info_dest.file_idx) ... .dependencies.explicit{end + 1, 1} = file_list{iFile};