aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-10-07 13:57:49 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:01 +0100
commitf079f82c1df9d43de8430534c39945901e705ea9 (patch)
tree39566d3145699cf3e4114c58f553ba042ef68c7e /src
parent61cdf3a3fe4a63464f67372fdd06109791865090 (diff)
Don't crash if the unit cell is too large
Diffstat (limited to 'src')
-rw-r--r--src/peaks.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/peaks.c b/src/peaks.c
index 4892d42f..9c172e73 100644
--- a/src/peaks.c
+++ b/src/peaks.c
@@ -542,12 +542,16 @@ int find_projected_peaks(struct image *image, UnitCell *cell,
hits[n_hits].k = k;
hits[n_hits].l = l;
n_hits++;
- assert(n_hits < MAX_HITS);
+ if ( n_hits == MAX_HITS ) {
+ ERROR("Unit cell is insanely large!\n");
+ goto out;
+ }
}
}
}
+out:
STATUS("Found %i reflections\n", n_hits);
image->hits = hits;
image->n_hits = n_hits;