From a02de84f62b98dda371f0c5003782705e9a0588e Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 19 Feb 2015 18:13:17 +0100 Subject: get_detector_geometry(): allow beam==NULL --- libcrystfel/src/detector.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'libcrystfel') 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 ) { -- cgit v1.2.3