aboutsummaryrefslogtreecommitdiff
path: root/src/statistics.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-05-25 17:51:04 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:27 +0100
commit42438f091125bbb0025ab27b97f7caedfd66447c (patch)
tree19398705a809cc78743c0fcb194f8f12ae68e8f2 /src/statistics.c
parent192b3acc937155a1851c7c8547d912dcdf5ff759 (diff)
compare_hkl: Don't crash if scale factor can't be found
Diffstat (limited to 'src/statistics.c')
-rw-r--r--src/statistics.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/statistics.c b/src/statistics.c
index da9a06c6..2312c4a7 100644
--- a/src/statistics.c
+++ b/src/statistics.c
@@ -418,7 +418,10 @@ static double r_minimised(RefList *list1, double *arr2, double *scalep, int fom)
double lo, up;
/* Iterate */
- gsl_min_fminimizer_iterate(s);
+ if ( gsl_min_fminimizer_iterate(s) ) {
+ ERROR("Failed to find scale factor.\n");
+ return NAN;
+ }
/* Get the current estimate */
scale = gsl_min_fminimizer_x_minimum(s);