Protect against bad data stored in ZHA (#30183)

This commit is contained in:
David F. Mulcahey 2019-12-23 19:11:35 -05:00 committed by Alexei Chetroi
parent 3aa2ae1700
commit 85d2ba047b

View file

@ -449,7 +449,11 @@ async def remove_group(group, zha_gateway):
group.group_id
)
)
await asyncio.gather(*tasks)
if tasks:
await asyncio.gather(*tasks)
else:
# we have members but none are tracked by ZHA for whatever reason
zha_gateway.application_controller.groups.pop(group.group_id)
else:
zha_gateway.application_controller.groups.pop(group.group_id)