Skip to content

Commit a621b79

Browse files
committedJul 4, 2024
Added checks for missing values in level control and on off
1 parent 9cf7932 commit a621b79

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
@@ -193,6 +193,7 @@ class DefaultOnOffSceneHandler : public scenes::DefaultSceneHandlerImpl
193193
{
194194
auto & decodePair = pair_iterator.GetValue();
195195
VerifyOrReturnError(decodePair.attributeID == Attributes::OnOff::Id, CHIP_ERROR_INVALID_ARGUMENT);
196+
VerifyOrReturnError(decodePair.valueUnsigned8.HasValue(), CHIP_ERROR_INVALID_ARGUMENT);
196197
ReturnErrorOnFailure(mSceneEndpointStatePairs.InsertPair(
197198
OnOffEndPointPair(endpoint, static_cast<bool>(decodePair.valueUnsigned8.Value()))));
198199
}

0 commit comments

Comments
 (0)