aboutsummaryrefslogtreecommitdiff
path: root/src/peaks.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-09-29 12:02:43 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:00 +0100
commit24f12798b7a280a40c77a11013c981a23e9502a0 (patch)
tree94f914b3c8735b9344ae892410678f0179960719 /src/peaks.c
parentdb5a9fb762bcda004ab11af63b741a2b97ea9028 (diff)
Ignore invalid peaks in sanity check
Diffstat (limited to 'src/peaks.c')
-rw-r--r--src/peaks.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/peaks.c b/src/peaks.c
index 385f3b83..b0a905eb 100644
--- a/src/peaks.c
+++ b/src/peaks.c
@@ -565,8 +565,7 @@ int peak_sanity_check(struct image *image, UnitCell *cell,
cell_get_cartesian(cell, &ax, &ay, &az, &bx, &by, &bz, &cx, &cy, &cz);
fesetround(1); /* Round towards nearest */
- n_feat = image_feature_count(image->features);
- for ( i=0; i<n_feat; i++ ) {
+ for ( i=0; i<image_feature_count(image->features); i++ ) {
double dist;
struct rvec q;
@@ -576,6 +575,8 @@ int peak_sanity_check(struct image *image, UnitCell *cell,
double dh, dk, dl;
f = image_get_feature(image->features, i);
+ if ( f == NULL ) continue;
+ n_feat++;
/* Get closest hkl */
q = get_q(image, f->x, f->y, 1, NULL, 1.0/image->lambda);