aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-02-19 18:13:17 +0100
committerThomas White <taw@physics.org>2015-02-19 18:13:39 +0100
commita02de84f62b98dda371f0c5003782705e9a0588e (patch)
tree14d26e682ff20308b5724021232c51b321dcebe3
parent1875d6b5ed546780a345bb4f15cf5ed7189f7b7f (diff)
get_detector_geometry(): allow beam==NULL
-rw-r--r--libcrystfel/src/detector.c14
-rw-r--r--src/list_events.c3
2 files changed, 9 insertions, 8 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c
index 482c0697..e5279f1d 100644
--- a/libcrystfel/src/detector.c
+++ b/libcrystfel/src/detector.c
@@ -1045,12 +1045,14 @@ static void parse_toplevel(struct detector *det, struct beam_params *beam,
det->defaults.coffset = atof(val);
} else if ( strcmp(key, "photon_energy") == 0 ) {
- if ( strncmp(val, "/", 1) == 0 ) {
- beam->photon_energy = 0.0;
- beam->photon_energy_from = strdup(val);
- } else {
- beam->photon_energy = atof(val);
- beam->photon_energy_from = NULL;
+ if ( beam != NULL ) {
+ if ( strncmp(val, "/", 1) == 0 ) {
+ beam->photon_energy = 0.0;
+ beam->photon_energy_from = strdup(val);
+ } else {
+ beam->photon_energy = atof(val);
+ beam->photon_energy_from = NULL;
+ }
}
} else if ( strcmp(key, "photon_energy_scale") == 0 ) {
diff --git a/src/list_events.c b/src/list_events.c
index fedb228b..1ef82701 100644
--- a/src/list_events.c
+++ b/src/list_events.c
@@ -71,7 +71,6 @@ int main(int argc, char *argv[])
FILE *ifh;
FILE *ofh;
struct detector *det;
- struct beam_params beam;
/* Long options */
const struct option longopts[] = {
@@ -142,7 +141,7 @@ int main(int argc, char *argv[])
return 1;
}
- det = get_detector_geometry(geom, &beam);
+ det = get_detector_geometry(geom, NULL);
if ( det == NULL ) {
ERROR("Failed to read '%s'\n", geom);
return 1;