Skip to content

Commit

Permalink
Removed un-necessary check (#36234)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpbeliveau-silabs authored and pull[bot] committed Nov 28, 2024
1 parent 59e162a commit 1168600
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1168600

Please sign in to comment.