Skip to content

Commit

Permalink
Two more replacements for state compare logic
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 committed Apr 17, 2024
1 parent 0fa6b4d commit ecf844b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/app/util/ember-compatibility-functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,13 @@ CHIP_ERROR ReadViaAccessInterface(SubjectDescriptor subjectDescriptor, bool aIsF
AttributeEncodeState * aEncoderState, AttributeAccessInterface * aAccessInterface,
bool * aTriedEncode)
{
AttributeEncodeState state = (aEncoderState == nullptr ? AttributeEncodeState() : *aEncoderState);
DataVersion version = 0;
AttributeEncodeState state;
if (aEncoderState != nullptr)
{
state = *aEncoderState;
}

DataVersion version = 0;
ReturnErrorOnFailure(ReadClusterDataVersion(aPath, version));
AttributeValueEncoder valueEncoder(aAttributeReports, subjectDescriptor, aPath, version, aIsFabricFiltered, state);
CHIP_ERROR err = aAccessInterface->Read(aPath, valueEncoder);
Expand Down
6 changes: 5 additions & 1 deletion src/app/util/mock/attribute-storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,11 @@ CHIP_ERROR ReadSingleMockClusterData(FabricIndex aAccessingFabricIndex, const Co
// Attribute 4 acts as a large attribute to trigger chunking.
if (aPath.mAttributeId == MockAttributeId(4))
{
AttributeEncodeState state = (apEncoderState == nullptr ? AttributeEncodeState() : *apEncoderState);
AttributeEncodeState state;
if (apEncoderState != nullptr)
{
state = *apEncoderState;
}
Access::SubjectDescriptor subject;
subject.fabricIndex = aAccessingFabricIndex;

Expand Down

0 comments on commit ecf844b

Please sign in to comment.