diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index bcdce87ca..089e2e7b0 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -2400,7 +2400,13 @@ defs::dacIndex Detector::getDacIndex(const std::string &name) const { throw RuntimeError("Dac name not found"); return static_cast(it - names.begin()); } - return StringTo(name); + auto retval = StringTo(name); + auto list = getDacList(); + if (std::find(list.begin(), list.end(), retval) == list.end()) { + throw RuntimeError("Dac name not found in dac list. Use 'daclist' to " + "get the list of dac names for this detector."); + } + return retval; } void Detector::setDacName(const defs::dacIndex i, const std::string &name) { @@ -2410,6 +2416,11 @@ void Detector::setDacName(const defs::dacIndex i, const std::string &name) { std::string Detector::getDacName(const defs::dacIndex i) const { if (pimpl->isChipTestBoard()) return pimpl->getCtbDacName(i); + auto list = getDacList(); + if (std::find(list.begin(), list.end(), i) == list.end()) { + throw RuntimeError("Dac index not found in dac list. Use 'daclist' to " + "get the list of dac indices for this detector."); + } return ToString(i); }