diff options
author | Thomas White <taw@physics.org> | 2022-10-05 16:03:30 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2022-10-05 16:03:30 +0200 |
commit | aff15b2e6995c9fcf51fd8ef9e253a1db0458c31 (patch) | |
tree | b813bc429be274da8458b724d322550f25ad625c /libcrystfel/src | |
parent | c1b68da99062d3d26eb49472c38b44ac5af64402 (diff) |
data_template_get_2d_detgeom_if_possible: Avoid segfault with adu_per_eV
Diffstat (limited to 'libcrystfel/src')
-rw-r--r-- | libcrystfel/src/datatemplate.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libcrystfel/src/datatemplate.c b/libcrystfel/src/datatemplate.c index bbcf1aa5..c270b128 100644 --- a/libcrystfel/src/datatemplate.c +++ b/libcrystfel/src/datatemplate.c @@ -2051,8 +2051,13 @@ struct detgeom *create_detgeom(struct image *image, break; case ADU_PER_EV: - p->adu_per_photon = tmpl->adu_scale - * ph_lambda_to_eV(image->lambda); + if ( image == NULL ) { + p->adu_per_photon = NAN; + ERROR("Cannot use adu_per_eV without image\n"); + } else { + p->adu_per_photon = tmpl->adu_scale + * ph_lambda_to_eV(image->lambda); + } break; default: |