diff --git a/lib/src/main/java/org/asamk/signal/manager/helper/StorageHelper.java b/lib/src/main/java/org/asamk/signal/manager/helper/StorageHelper.java index 960ed1d5..dfed3d43 100644 --- a/lib/src/main/java/org/asamk/signal/manager/helper/StorageHelper.java +++ b/lib/src/main/java/org/asamk/signal/manager/helper/StorageHelper.java @@ -129,18 +129,18 @@ public class StorageHelper { final var groupV1Record = record.getGroupV1().get(); final var groupIdV1 = GroupId.v1(groupV1Record.getGroupId()); - final var group = account.getGroupStore().getGroup(groupIdV1); + var group = account.getGroupStore().getGroup(groupIdV1); if (group == null) { try { context.getGroupHelper().sendGroupInfoRequest(groupIdV1, account.getSelfRecipientId()); } catch (Throwable e) { logger.warn("Failed to send group request", e); } + group = account.getGroupStore().getOrCreateGroupV1(groupIdV1); } - final var groupV1 = account.getGroupStore().getOrCreateGroupV1(groupIdV1); - if (groupV1.isBlocked() != groupV1Record.isBlocked()) { - groupV1.setBlocked(groupV1Record.isBlocked()); - account.getGroupStore().updateGroup(groupV1); + if (group != null && group.isBlocked() != groupV1Record.isBlocked()) { + group.setBlocked(groupV1Record.isBlocked()); + account.getGroupStore().updateGroup(group); } }