From f94e409ecab79d98f47a52d5ac706f1d004efe02 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Thu, 24 Oct 2024 13:47:14 -0400 Subject: [PATCH] Removed un-necessary check --- .../dishwasher-app/silabs/src/ElectricalSensorManager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/dishwasher-app/silabs/src/ElectricalSensorManager.cpp b/examples/dishwasher-app/silabs/src/ElectricalSensorManager.cpp index c751c71c268255..cf7e4806a7828a 100644 --- a/examples/dishwasher-app/silabs/src/ElectricalSensorManager.cpp +++ b/examples/dishwasher-app/silabs/src/ElectricalSensorManager.cpp @@ -196,12 +196,12 @@ void ElectricalSensorManager::UpdateEPMAttributes(OperationalStateEnum state) { if (gEPMDelegate) { - uint16_t updateState = to_underlying(state); - uint16_t ERROR_STATE_INDEX = ArraySize(kAttributes) - 1; + uint8_t updateState = to_underlying(state); + // Check state range - if ((updateState < 0) || (updateState > ERROR_STATE_INDEX)) + if (updateState >= ArraySize(kAttributes)) { - updateState = ERROR_STATE_INDEX; + updateState = ArraySize(kAttributes) - 1; } ChipLogDetail(AppServer, "UpdateAllAttributes to Operational State : %d", updateState);