From 02a018462bd6d30d8b20eb4acce81238333c3640 Mon Sep 17 00:00:00 2001 From: AsamK Date: Wed, 6 Apr 2022 22:28:07 +0200 Subject: [PATCH] Prevent deleting a group locally if the user is still a member Fixes #924 --- lib/src/main/java/org/asamk/signal/manager/ManagerImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/src/main/java/org/asamk/signal/manager/ManagerImpl.java b/lib/src/main/java/org/asamk/signal/manager/ManagerImpl.java index aa4752a2..45ec09f9 100644 --- a/lib/src/main/java/org/asamk/signal/manager/ManagerImpl.java +++ b/lib/src/main/java/org/asamk/signal/manager/ManagerImpl.java @@ -348,6 +348,11 @@ class ManagerImpl implements Manager { @Override public void deleteGroup(GroupId groupId) throws IOException { + final var group = context.getGroupHelper().getGroup(groupId); + if (group.isMember(account.getSelfRecipientId())) { + throw new IOException( + "The local group information cannot be removed, as the user is still a member of the group"); + } context.getGroupHelper().deleteGroup(groupId); }