From 60c2e01b0faa0ff4955d9ffe1e99c7c8cffc2c5c Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 5 Jun 2010 15:40:10 +0200 Subject: Fix/add exit paths --- src/diffraction.c | 1 + src/pattern_sim.c | 3 +++ src/peaks.c | 4 +--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/diffraction.c b/src/diffraction.c index b3e80e8f..9bd7c4e5 100644 --- a/src/diffraction.c +++ b/src/diffraction.c @@ -248,6 +248,7 @@ struct rvec get_q(struct image *image, unsigned int xs, unsigned int ys, const unsigned int y = ys / sampling; /* Integer part only */ p = find_panel(&image->det, x, y); + assert(p != NULL); rx = ((float)xs - (sampling*p->cx)) / (sampling * p->res); ry = ((float)ys - (sampling*p->cy)) / (sampling * p->res); diff --git a/src/pattern_sim.c b/src/pattern_sim.c index 39931bdb..05cdcf9d 100644 --- a/src/pattern_sim.c +++ b/src/pattern_sim.c @@ -319,6 +319,9 @@ int main(int argc, char *argv[]) image.height = 1024; image.lambda = ph_en_to_lambda(eV_to_J(PHOTON_ENERGY)); /* Wavelength */ cell = load_cell_from_pdb(filename); + if ( cell == NULL ) { + exit(1); + } image.filename = NULL; image.features = NULL; image.flags = NULL; diff --git a/src/peaks.c b/src/peaks.c index 68482e94..e4853a71 100644 --- a/src/peaks.c +++ b/src/peaks.c @@ -167,9 +167,7 @@ static int integrate_peak(struct image *image, int xp, int yp, } p = find_panel(&image->det, x+xp, y+yp); - if ( p == NULL ) { - return 1; - } + if ( p == NULL ) return 1; /* Area of one pixel */ pix_area = pow(1.0/p->res, 2.0); -- cgit v1.2.3