Skip to content

Commit

Permalink
Validate if the Current Group = RemovedGroup or check if CurrentScene…
Browse files Browse the repository at this point in the history
… is in RemovedGroup before invalidating the scene.
  • Loading branch information
mpbreton committed Aug 7, 2023
1 parent ed545c4 commit 3564e53
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/app/clusters/scenes-server/scenes-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,19 @@ void ScenesServer::GroupWillBeRemoved(FabricIndex aFabricIx, EndpointId aEndpoin
SceneTable * sceneTable = scenes::GetSceneTableImpl(aEndpointId);
VerifyOrReturn(nullptr != sceneTable);

MakeSceneInvalid(aEndpointId);
chip::GroupId * currentGroup;
Attributes::CurrentGroup::Get(aEndpointId, currentGroup);

chip::SceneId * currentScene;
Attributes::CurrentScene::Get(aEndpointId,currentScene);

//Validate if the Current Group = RemovedGroup or check if CurrentScene is in RemovedGroup before invalidating the scene.
SceneTableEntry entry;
if(aGroupId == *currentGroup || sceneTable->GetSceneTableEntry(aFabricIx,SceneStorageId(*currentScene,*currentGroup),entry) == CHIP_NO_ERROR)
{
MakeSceneInvalid(aEndpointId);
}


VerifyOrReturn(nullptr != mGroupProvider);
if (0 != aGroupId && !mGroupProvider->HasEndpoint(aFabricIx, aGroupId, aEndpointId))
Expand Down

0 comments on commit 3564e53

Please sign in to comment.