aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-12-19 12:23:47 +0100
committerThomas White <taw@physics.org>2023-12-19 12:24:46 +0100
commit32efc83f9587844a27ba67c83a1b77a9e60efbb3 (patch)
tree2ab2c885b0fb8bc26b14ff61b1ebed074b8da0f1
parent28ecd688c994dce0bb66856ca16ada7d19c0d1ed (diff)
Check for duplicate member in panel group
Example: group_all = q0,q1,q2,q2
-rw-r--r--libcrystfel/src/datatemplate.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libcrystfel/src/datatemplate.c b/libcrystfel/src/datatemplate.c
index 4a6ced88..e480779c 100644
--- a/libcrystfel/src/datatemplate.c
+++ b/libcrystfel/src/datatemplate.c
@@ -115,6 +115,19 @@ static int parse_group(const char *name, DataTemplate *dt, const char *val)
fail = 1;
} else {
+ /* A simple typo in the geometry file can segfault other
+ * stuff, so check */
+ for ( i=0; i<n_members; i++ ) {
+ int j;
+ for ( j=0; j<i; j++ ) {
+ if ( strcmp(members[i], members[j]) == 0 ) {
+ ERROR("Duplicate member '%s' in group '%s'\n",
+ members[i], name);
+ fail = 1;
+ }
+ }
+ }
+
for ( i=0; i<n_members; i++ ) {
gt->children[i] = find_group(dt, members[i]);
if ( gt->children[i] == NULL ) {