Skip to content

Commit bcaf6ca

Browse files
committed
Only persist cluster data when there is something to persist
1 parent 8edbf80 commit bcaf6ca

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/darwin/Framework/CHIP/MTRDevice.mm

+4-2
Original file line numberDiff line numberDiff line change
@@ -859,8 +859,10 @@ - (void)_handleReportBegin
859859
for (MTRClusterPath * clusterPath in clusterPaths) {
860860
NSNumber * dataVersion = _clusterData[clusterPath].dataVersion;
861861
NSDictionary<NSNumber *, MTRDeviceDataValueDictionary> * attributes = [self _attributesForCluster:clusterPath];
862-
MTRDeviceClusterData * clusterData = [[MTRDeviceClusterData alloc] initWithDataVersion:dataVersion attributes:attributes];
863-
clusterDataToReturn[clusterPath] = clusterData;
862+
if (dataVersion || attributes) {
863+
MTRDeviceClusterData * clusterData = [[MTRDeviceClusterData alloc] initWithDataVersion:dataVersion attributes:attributes];
864+
clusterDataToReturn[clusterPath] = clusterData;
865+
}
864866
}
865867

866868
return clusterDataToReturn;

0 commit comments

Comments
 (0)