From d7f0e3d7fff9bb91b204608a9b6749fceeee8f50 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 21 Sep 2022 10:40:11 +0200 Subject: [PATCH] Fix GetCalibInfo --- src/ExternLib/GetClbInfo/GetClbInfo.hh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/ExternLib/GetClbInfo/GetClbInfo.hh b/src/ExternLib/GetClbInfo/GetClbInfo.hh index 36c3137..fbabde6 100644 --- a/src/ExternLib/GetClbInfo/GetClbInfo.hh +++ b/src/ExternLib/GetClbInfo/GetClbInfo.hh @@ -109,13 +109,16 @@ public: ElementType value = _paramInput.getDataList()[index]; std::vector calib; calib.resize(_maxSize, std::nan("")); - if (!isNAN(value)) { - Parameter::InfoValues* info = _calibrationInfoList[(int)floor(value)]; - - int i = 0; - for (std::vector::iterator it = info->begin(); it != info->end(); ++it) { - calib[i] = (*it); - ++i; + int clb_index = (int)floor(value); + if (!isNAN(value) && (clb_index >= 0) && (clb_index < _calibrationInfoList.size())) { + Parameter::InfoValues* info = _calibrationInfoList[clb_index]; + + if (info != NULL) { + int i = 0; + for (std::vector::iterator it = info->begin(); it != info->end(); ++it) { + calib[i] = (*it); + ++i; + } } } -- libgit2 0.21.2