aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-06-05 15:40:10 +0200
committerThomas White <taw@bitwiz.org.uk>2010-06-05 15:40:10 +0200
commit60c2e01b0faa0ff4955d9ffe1e99c7c8cffc2c5c (patch)
tree8f1920b724f7598c11e9dcf2028656613cec8e6d
parentea369696428af621a3acfd53791d9c98d4402584 (diff)
Fix/add exit paths
-rw-r--r--src/diffraction.c1
-rw-r--r--src/pattern_sim.c3
-rw-r--r--src/peaks.c4
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);