aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-12-11 14:05:44 +0100
committerThomas White <taw@physics.org>2017-12-12 11:09:39 +0100
commit4cb540245744f3e8da5ba8f63b26120df066426a (patch)
tree25c6eb3c0ec3674e5b27d5e2303c8a9d02602724
parent1161fc80e9d23d83e325d7372f92a410b2498837 (diff)
check_hkl: Check for limiting top bin case
-rw-r--r--src/check_hkl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/check_hkl.c b/src/check_hkl.c
index 3c71d4cc..1657eb6f 100644
--- a/src/check_hkl.c
+++ b/src/check_hkl.c
@@ -38,6 +38,7 @@
#include <unistd.h>
#include <getopt.h>
#include <gsl/gsl_fit.h>
+#include <assert.h>
#include "version.h"
#include "utils.h"
@@ -314,6 +315,9 @@ static void wilson_plot(RefList *list, UnitCell *cell, const SymOpList *sym,
E += 1.50*get_sfac('O', s);
E += 8.00*get_sfac('H', s);
+ if ( bin == nbins ) bin = nbins-1;
+ assert(bin < nbins);
+
plot_i[bin] += intensity / (e*E);
plot_n[bin]++;