aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/detector.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcrystfel/src/detector.c')
-rw-r--r--libcrystfel/src/detector.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c
index d4d8b768..b44f2d43 100644
--- a/libcrystfel/src/detector.c
+++ b/libcrystfel/src/detector.c
@@ -956,10 +956,25 @@ static int parse_field_for_panel(struct panel *panel, const char *key,
reject = 1;
}
} else if ( strncmp(key, "dim", 3) == 0) {
- if ( panel->dim_structure == NULL ) {
- panel->dim_structure = initialize_dim_structure();
+ int dim_entry;
+ char *endptr;
+ if ( key[3] != '\0' ) {
+ if ( panel->dim_structure == NULL ) {
+ panel->dim_structure = initialize_dim_structure();
+ }
+ dim_entry = strtoul(key+3, &endptr, 10);
+ if ( endptr[0] != '\0' ) {
+ ERROR("Invalid dimension number %s\n", key+3);
+ } else {
+ if ( set_dim_structure_entry(panel->dim_structure,
+ dim_entry, val) )
+ {
+ ERROR("Failed to set dim structure entry\n");
+ }
+ }
+ } else {
+ ERROR("'dim' must be followed by a number, e.g. 'dim0'\n");
}
- set_dim_structure_entry(panel->dim_structure, key, val);
} else {
ERROR("Unrecognised field '%s'\n", key);
}