Skip to content

Commit

Permalink
[Darwin]Fix segmentation fault on writing userLabelList (#17005)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca authored and pull[bot] committed Jan 27, 2024
1 parent c884a82 commit 1011920
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/app/clusters/user-label-server/user-label-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ CHIP_ERROR UserLabelAttrAccess::ReadLabelList(EndpointId endpoint, AttributeValu

CHIP_ERROR UserLabelAttrAccess::WriteLabelList(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder)
{
EndpointId endpoint = aPath.mEndpointId;
EndpointId endpoint = aPath.mEndpointId;
DeviceLayer::DeviceInfoProvider * provider = DeviceLayer::GetDeviceInfoProvider();

VerifyOrReturnError(provider != nullptr, CHIP_ERROR_NOT_IMPLEMENTED);

if (!aPath.IsListItemOperation())
{
DeviceLayer::AttributeList<Structs::LabelStruct::Type, DeviceLayer::kMaxUserLabelListLength> labelList;
Expand All @@ -111,13 +115,13 @@ CHIP_ERROR UserLabelAttrAccess::WriteLabelList(const ConcreteDataAttributePath &
}
ReturnErrorOnFailure(iter.GetStatus());

return DeviceLayer::GetDeviceInfoProvider()->SetUserLabelList(endpoint, labelList);
return provider->SetUserLabelList(endpoint, labelList);
}
else if (aPath.mListOp == ConcreteDataAttributePath::ListOperation::AppendItem)
{
Structs::LabelStruct::DecodableType entry;
ReturnErrorOnFailure(aDecoder.Decode(entry));
return DeviceLayer::GetDeviceInfoProvider()->AppendUserLabel(endpoint, entry);
return provider->AppendUserLabel(endpoint, entry);
}
else
{
Expand Down

0 comments on commit 1011920

Please sign in to comment.