aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-05-15 16:45:44 +0200
committerThomas White <taw@physics.org>2015-05-19 13:57:52 +0200
commita9668bc9b0bbb93cf2bbc7c2048c7019d38f9bdf (patch)
treefd8b6c81aeee44e696060c2463121f30f349da57 /src
parenteb70c90909cd98278e6fa969078c0b710cc8149e (diff)
Refuse all nan shifts
Diffstat (limited to 'src')
-rw-r--r--src/post-refinement.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/post-refinement.c b/src/post-refinement.c
index d314b536..aed15c2e 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -274,15 +274,17 @@ static void apply_shift(Crystal *cr, int k, double shift)
double t;
struct image *image = crystal_get_image(cr);
+ if ( isnan(shift) ) {
+ ERROR("Refusing NaN shift for parameter %i\n", k);
+ ERROR("Image serial %i\n", image->serial);
+ return;
+ }
+
switch ( k ) {
case GPARAM_DIV :
- if ( isnan(shift) ) {
- ERROR("NaN divergence shift\n");
- } else {
- image->div += shift;
- if ( image->div < 0.0 ) image->div = 0.0;
- }
+ image->div += shift;
+ if ( image->div < 0.0 ) image->div = 0.0;
break;
case GPARAM_R :