diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ea4d1f..77207cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,8 +82,6 @@ target_include_directories( ${EPICSSYS}/include/compiler/clang ) - - ################################################################################ ## Frontend ################################################################################ diff --git a/src/device/power_switch.cpp b/src/device/power_switch.cpp index 64106eb..4cefc26 100644 --- a/src/device/power_switch.cpp +++ b/src/device/power_switch.cpp @@ -118,6 +118,12 @@ void powerSwitch::updateOutletNumber() { } void powerSwitch::sendCommand(int index) { + if (index < 0 || index >= (int)outlets.size()) { + fMfe->Msg(MERROR, __FUNCTION__, + "Command received for outlet %d but only %d outlet(s) ready", + index, (int)outlets.size()); + return; + } midas::odb o(this->equipmentPath); std::string command = o[COMMAND_PATH.c_str()][index]; Outlet *outlet = &outlets.at(index);