diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index bc302bac..1a31e608 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -81,12 +81,16 @@ ReturnValue_t PCDUHandler::initialize() { void PCDUHandler::initializeSwitchStates() { using namespace pcdu; - for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) { - if (idx < PDU::CHANNELS_LEN) { - switchStates[idx] = INIT_SWITCHES_PDU1[idx]; - } else { - switchStates[idx] = INIT_SWITCHES_PDU2[idx]; + try { + for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) { + if (idx < PDU::CHANNELS_LEN) { + switchStates[idx] = INIT_SWITCHES_PDU1.at(idx); + } else { + switchStates[idx] = INIT_SWITCHES_PDU2.at(idx - PDU::CHANNELS_LEN); + } } + } catch (const std::out_of_range& err) { + sif::error << "PCDUHandler::initializeSwitchStates: " << err.what() << std::endl; } }