Skip to content

Commit ecf844b

Browse files
committed
Two more replacements for state compare logic
1 parent 0fa6b4d commit ecf844b

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/app/util/ember-compatibility-functions.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,13 @@ CHIP_ERROR ReadViaAccessInterface(SubjectDescriptor subjectDescriptor, bool aIsF
430430
AttributeEncodeState * aEncoderState, AttributeAccessInterface * aAccessInterface,
431431
bool * aTriedEncode)
432432
{
433-
AttributeEncodeState state = (aEncoderState == nullptr ? AttributeEncodeState() : *aEncoderState);
434-
DataVersion version = 0;
433+
AttributeEncodeState state;
434+
if (aEncoderState != nullptr)
435+
{
436+
state = *aEncoderState;
437+
}
438+
439+
DataVersion version = 0;
435440
ReturnErrorOnFailure(ReadClusterDataVersion(aPath, version));
436441
AttributeValueEncoder valueEncoder(aAttributeReports, subjectDescriptor, aPath, version, aIsFabricFiltered, state);
437442
CHIP_ERROR err = aAccessInterface->Read(aPath, valueEncoder);

src/app/util/mock/attribute-storage.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,11 @@ CHIP_ERROR ReadSingleMockClusterData(FabricIndex aAccessingFabricIndex, const Co
350350
// Attribute 4 acts as a large attribute to trigger chunking.
351351
if (aPath.mAttributeId == MockAttributeId(4))
352352
{
353-
AttributeEncodeState state = (apEncoderState == nullptr ? AttributeEncodeState() : *apEncoderState);
353+
AttributeEncodeState state;
354+
if (apEncoderState != nullptr)
355+
{
356+
state = *apEncoderState;
357+
}
354358
Access::SubjectDescriptor subject;
355359
subject.fabricIndex = aAccessingFabricIndex;
356360

0 commit comments

Comments
 (0)