Skip to content

Commit 7dd44a2

Browse files
address comments
1 parent 2a1bc4f commit 7dd44a2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/app/clusters/level-control/level-control.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ static void moveHandler(app::CommandHandler * commandObj, const app::ConcreteCom
958958
EndpointId endpoint = commandPath.mEndpointId;
959959
CommandId commandId = commandPath.mCommandId;
960960
// Validate the received rate and moveMode first.
961-
if ((!rate.IsNull() && (rate.Value() == 0)) || moveMode == MoveModeEnum::kUnknownEnumValue)
961+
if (rate == static_cast<uint8_t>(0) || moveMode == MoveModeEnum::kUnknownEnumValue)
962962
{
963963
status = Status::InvalidCommand;
964964
goto send_default_response;
@@ -992,9 +992,12 @@ static void moveHandler(app::CommandHandler * commandObj, const app::ConcreteCom
992992
}
993993
else
994994
{
995-
// Error out if DefaultMoveRate is equal to 0
995+
// This should never occur, but old devices could have this, now invalid, value stored.
996996
if (defaultMoveRate.Value() == 0)
997997
{
998+
// The spec is not explicit about what should be done if this happens.
999+
// For now Error out if DefaultMoveRate is equal to 0 as this is invalid
1000+
// until spec defines a behaviour.
9981001
status = Status::InvalidCommand;
9991002
goto send_default_response;
10001003
}

0 commit comments

Comments
 (0)