From 42438f091125bbb0025ab27b97f7caedfd66447c Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 25 May 2011 17:51:04 +0200 Subject: compare_hkl: Don't crash if scale factor can't be found --- src/statistics.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/statistics.c') 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); -- cgit v1.2.3