From 41dedeef25ef0a3ad2ade5089796d9ddbb9737ac Mon Sep 17 00:00:00 2001 From: Gordon McCann Date: Mon, 21 Feb 2022 21:14:35 -0500 Subject: [PATCH] Hotfix: accidentally removed check on whether parameter value was in bounds for a histogram, replaced the check for both 1d and 2d --- Navigator/src/Navigator/Histogram.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Navigator/src/Navigator/Histogram.cpp b/Navigator/src/Navigator/Histogram.cpp index 950ee62..19d08b6 100644 --- a/Navigator/src/Navigator/Histogram.cpp +++ b/Navigator/src/Navigator/Histogram.cpp @@ -45,6 +45,8 @@ namespace Navigator { //Note: only x is used here, y is simply present to maintain compliance with 2D case and can be ignored void Histogram1D::FillData(double x, double y) { + if (x < m_params.min_x || x >= m_params.max_x) + return; int bin = int((x - m_params.min_x)/(m_binWidth)); m_binCounts[bin] += 1.0; } @@ -128,6 +130,8 @@ namespace Navigator { void Histogram2D::FillData(double x, double y) { + if (x < m_params.min_x || x >= m_params.max_x || y < m_params.min_y || y >= m_params.max_y) + return; int bin_x = int((x - m_params.min_x)/m_binWidthX); int bin_y = int((m_params.max_y - y)/m_binWidthY); int bin = bin_y*m_params.nbins_x + bin_x;