Skip to content

Commit

Permalink
Validate if the Current Group = RemovedGroup before invalidating scene (
Browse files Browse the repository at this point in the history
#28565)

* Validate if the Current Group = RemovedGroup or check if CurrentScene is in RemovedGroup before invalidating the scene.

* Fix nonsensical code

* ditto

* ditto bis

* restyle

* Remove check that was not specification compliant

* Cleanup

* Update src/app/clusters/scenes-server/scenes-server.cpp

Co-authored-by: Boris Zbarsky <[email protected]>

---------

Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Aug 16, 2023
1 parent d179251 commit 70bf3bc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 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,15 @@ 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);

// If currentGroup is what is being removed, we can't possibly still have a valid scene,
// because the scene we have (if any) will also be removed.
if (aGroupId == currentGroup)
{
MakeSceneInvalid(aEndpointId);
}

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

0 comments on commit 70bf3bc

Please sign in to comment.