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 Oct 24, 2024
1 parent 6ee1913 commit 019dcc7
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 019dcc7

Please sign in to comment.