aboutsummaryrefslogtreecommitdiff
path: root/src/post-refinement.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-01-28 14:37:09 +0100
committerThomas White <taw@physics.org>2019-01-28 14:55:31 +0100
commit339e02b22b51cb344d4aea26fe86281f9dbe6322 (patch)
treed3bf6ce80b752059bbecedface4b8a8ca73bed1d /src/post-refinement.c
parent84166d9d376ae7dd85f7f6df5c3b386d84cdf514 (diff)
partialator: Catch failure to set up post-refinement minimiser
Diffstat (limited to 'src/post-refinement.c')
-rw-r--r--src/post-refinement.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/post-refinement.c b/src/post-refinement.c
index fd0d5c4e..7c388f8d 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -620,7 +620,15 @@ static gsl_multimin_fminimizer *setup_minimiser(Crystal *cr, const RefList *full
min = gsl_multimin_fminimizer_alloc(gsl_multimin_fminimizer_nmsimplex2,
n_params);
- gsl_multimin_fminimizer_set(min, &priv->f, priv->vals, priv->step);
+ if ( min == NULL ) {
+ ERROR("Failed to allocate minimiser\n");
+ return NULL;
+ }
+
+ if ( gsl_multimin_fminimizer_set(min, &priv->f, priv->vals, priv->step) ) {
+ ERROR("Failed to set up minimiser\n");
+ return NULL;
+ }
return min;
}
@@ -734,6 +742,7 @@ static void do_pr_refine(Crystal *cr, const RefList *full,
}
min = setup_minimiser(cr, full, verbose, serial, scaleflags, &priv);
+ if ( min == NULL ) return;
if ( verbose ) {
double res = residual_f(min->x, &priv);