Skip to content

Commit

Permalink
Remove the unnecessary check condition
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca committed Mar 31, 2022
1 parent cabb5fc commit 799ae90
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions src/app/clusters/fixed-label-server/fixed-label-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,16 @@ CHIP_ERROR FixedLabelAttrAccess::ReadLabelList(EndpointId endpoint, AttributeVal

if (it)
{
if (it->Count() > 0)
{
err = aEncoder.EncodeList([&it](const auto & encoder) -> CHIP_ERROR {
FixedLabel::Structs::LabelStruct::Type fixedlabel;

while (it->Next(fixedlabel))
{
ReturnErrorOnFailure(encoder.Encode(fixedlabel));
}

return CHIP_NO_ERROR;
});
}
else
{
err = aEncoder.EncodeEmptyList();
}
err = aEncoder.EncodeList([&it](const auto & encoder) -> CHIP_ERROR {
FixedLabel::Structs::LabelStruct::Type fixedlabel;

while (it->Next(fixedlabel))
{
ReturnErrorOnFailure(encoder.Encode(fixedlabel));
}

return CHIP_NO_ERROR;
});

it->Release();
}
Expand Down

0 comments on commit 799ae90

Please sign in to comment.