Skip to content

Commit e9a88d8

Browse files
Added checks for missing values in level control and on off
1 parent 7cf2b72 commit e9a88d8

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

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

+2
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,12 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl
225225
switch (decodePair.attributeID)
226226
{
227227
case Attributes::CurrentLevel::Id:
228+
VerifyOrReturnError(decodePair.valueUnsigned8.HasValue(), CHIP_ERROR_INVALID_ARGUMENT);
228229
level = decodePair.valueUnsigned8.Value();
229230
break;
230231
case Attributes::CurrentFrequency::Id:
231232
// TODO : Uncomment when frequency is supported by the level control cluster
233+
// VerifyOrReturnError(decodePair.valueUnsigned16.HasValue(), CHIP_ERROR_INVALID_ARGUMENT);
232234
// frequency = decodePair.valueUnsigned16.Value();
233235
break;
234236
default:

src/app/clusters/on-off-server/on-off-server.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ class DefaultOnOffSceneHandler : public scenes::DefaultSceneHandlerImpl
195195
{
196196
auto & decodePair = pair_iterator.GetValue();
197197
VerifyOrReturnError(decodePair.attributeID == Attributes::OnOff::Id, CHIP_ERROR_INVALID_ARGUMENT);
198+
VerifyOrReturnError(decodePair.valueUnsigned8.HasValue(), CHIP_ERROR_INVALID_ARGUMENT);
198199
ReturnErrorOnFailure(mSceneEndpointStatePairs.InsertPair(
199200
OnOffEndPointPair(endpoint, static_cast<bool>(decodePair.valueUnsigned8.Value()))));
200201
}

0 commit comments

Comments
 (0)