From 6f55de63b6aa64481db0e294844f39a1ca7fffee Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 7 Nov 2022 20:39:04 +0100 Subject: check_hkl: Make --wilson more robust against invalid data --- src/check_hkl.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/check_hkl.c b/src/check_hkl.c index aa972a7f..d01303d4 100644 --- a/src/check_hkl.c +++ b/src/check_hkl.c @@ -359,17 +359,25 @@ static void wilson_plot(RefList *list, UnitCell *cell, const SymOpList *sym, double *s2fit; double *lnifit; int nbfit = 0; + int ndisc = 0; s2fit = malloc(nbins*sizeof(double)); lnifit = malloc(nbins*sizeof(double)); if ( (s2fit==NULL) || (lnifit==NULL) ) return; for ( i=0; i 0 ) { + ERROR("%i bins contained invalid values " + "and were ignored.\n", ndisc); + } if ( nbfit < 3 ) { - ERROR("Too many bits had invalid values.\n"); + ERROR("Not enough bins left.\n"); return; } gsl_fit_linear(s2fit, 1, lnifit, 1, nbfit, -- cgit v1.2.3