aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/detector.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-07-31 10:36:38 +0200
committerThomas White <taw@physics.org>2019-07-31 10:36:38 +0200
commit23a6af9398fbfa89c87f412ed139a76e44fa9d65 (patch)
tree9f12ef5c348745fcb19e4f87d6046e1c119d2512 /libcrystfel/src/detector.c
parent9dc76221b9cdb0f72110dbf83893177f23f20634 (diff)
copy_geom: Tidy up logic some more
Diffstat (limited to 'libcrystfel/src/detector.c')
-rw-r--r--libcrystfel/src/detector.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c
index ac33bbc0..5055139f 100644
--- a/libcrystfel/src/detector.c
+++ b/libcrystfel/src/detector.c
@@ -1798,10 +1798,10 @@ struct detector *copy_geom(const struct detector *in)
if ( in == NULL ) return NULL;
out = malloc(sizeof(struct detector));
- memcpy(out, in, sizeof(struct detector));
+ if ( out == NULL ) return NULL;
- /* Copy all fields */
- *out = *in;
+ /* Copy everything */
+ memcpy(out, in, sizeof(struct detector));
out->panels = malloc(out->n_panels * sizeof(struct panel));
memcpy(out->panels, in->panels, out->n_panels * sizeof(struct panel));