aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-10-31 14:32:26 +0100
committerThomas White <taw@physics.org>2014-10-31 14:32:26 +0100
commit1f572ce2766aac1b1f41d696d3110864850fe77f (patch)
treeaaec9c615c7fe93135a81c7d7ab200968d783a89 /libcrystfel
parent4b7f031271a7f77a99c86b3010c97e426068675e (diff)
get_detector_geometry(): Avoid NULL dereference when beam=NULL
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/detector.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c
index 5bdfcec2..72b72f08 100644
--- a/libcrystfel/src/detector.c
+++ b/libcrystfel/src/detector.c
@@ -937,9 +937,11 @@ struct detector *get_detector_geometry(const char *filename,
return NULL;
}
- beam->photon_energy = -1.0;
- beam->photon_energy_from = NULL;
- beam->photon_energy_scale = 1.0;
+ if ( beam != NULL ) {
+ beam->photon_energy = -1.0;
+ beam->photon_energy_from = NULL;
+ beam->photon_energy_scale = 1.0;
+ }
det->n_panels = 0;
det->panels = NULL;
@@ -1280,7 +1282,7 @@ struct detector *get_detector_geometry(const char *filename,
}
}
- if ( beam->photon_energy < -0.5 ) {
+ if ( (beam != NULL) && (beam->photon_energy < -0.5) ) {
STATUS("Photon energy must be specified (note: this is now "
"done in the 'geometry' file.\n");
reject = 1;