From f5cb7fe28e0de3c3ae9d7053a4af326300fd52e3 Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Mon, 11 Nov 2024 10:11:04 -0500 Subject: [PATCH 1/2] add condition, make sure tag exists --- dcm2bids/sidecar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dcm2bids/sidecar.py b/dcm2bids/sidecar.py index 0cb7ba07..f397e3fd 100644 --- a/dcm2bids/sidecar.py +++ b/dcm2bids/sidecar.py @@ -396,7 +396,7 @@ def compare_float(name, pattern): elif isinstance(name, list): result.append(compare_list(name, pattern)) - else: + elif name: result.append(compare(name, pattern)) return all(result) From 3292d4613c4afa455a9036b43a6565a941af3bb3 Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Mon, 11 Nov 2024 11:46:11 -0500 Subject: [PATCH 2/2] when tag not found return false --- dcm2bids/sidecar.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dcm2bids/sidecar.py b/dcm2bids/sidecar.py index f397e3fd..294f1474 100644 --- a/dcm2bids/sidecar.py +++ b/dcm2bids/sidecar.py @@ -398,6 +398,8 @@ def compare_float(name, pattern): result.append(compare_list(name, pattern)) elif name: result.append(compare(name, pattern)) + else: + result.append(False) return all(result)