diff options
author | Thomas White <taw@physics.org> | 2011-06-22 17:30:06 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:28 +0100 |
commit | 2cb199e1062b3bba2f029eb8a0c5a51b9c4df2da (patch) | |
tree | a4afee50b5894a1061a4e420841e67799e0bba7d /src | |
parent | bcc00985f499261aed26511b5b5d55aa833cb3dd (diff) |
Safeguard against silly unit cells in find_intersections()
Diffstat (limited to 'src')
-rw-r--r-- | src/geometry.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/geometry.c b/src/geometry.c index 440f7698..253456b7 100644 --- a/src/geometry.c +++ b/src/geometry.c @@ -257,6 +257,14 @@ RefList *find_intersections(struct image *image, UnitCell *cell, kmax = mres / modulus(bsx, bsy, bsz); lmax = mres / modulus(csx, csy, csz); + if ( (hmax >= 256) || (kmax >= 256) || (lmax >= 256) ) { + ERROR("Unit cell is stupidly large.\n"); + cell_print(cell); + if ( hmax >= 256 ) hmax = 255; + if ( kmax >= 256 ) kmax = 255; + if ( lmax >= 256 ) lmax = 255; + } + for ( h=-hmax; h<=hmax; h++ ) { for ( k=-kmax; k<=kmax; k++ ) { for ( l=-lmax; l<=lmax; l++ ) { |