Prevent groupV2Operations from being null

This commit is contained in:
AsamK 2023-11-21 17:17:26 +01:00
parent 5882a1b2a5
commit 22bab461b5
2 changed files with 5 additions and 9 deletions

View file

@ -60,6 +60,7 @@ public class RegistrationManagerImpl implements RegistrationManager {
private final ServiceEnvironmentConfig serviceEnvironmentConfig; private final ServiceEnvironmentConfig serviceEnvironmentConfig;
private final String userAgent; private final String userAgent;
private final Consumer<Manager> newManagerListener; private final Consumer<Manager> newManagerListener;
private final GroupsV2Operations groupsV2Operations;
private final SignalServiceAccountManager accountManager; private final SignalServiceAccountManager accountManager;
private final PinHelper pinHelper; private final PinHelper pinHelper;
@ -80,13 +81,8 @@ public class RegistrationManagerImpl implements RegistrationManager {
this.userAgent = userAgent; this.userAgent = userAgent;
this.newManagerListener = newManagerListener; this.newManagerListener = newManagerListener;
GroupsV2Operations groupsV2Operations; groupsV2Operations = new GroupsV2Operations(ClientZkOperations.create(serviceEnvironmentConfig.signalServiceConfiguration()),
try { ServiceConfig.GROUP_MAX_SIZE);
groupsV2Operations = new GroupsV2Operations(ClientZkOperations.create(serviceEnvironmentConfig.signalServiceConfiguration()),
ServiceConfig.GROUP_MAX_SIZE);
} catch (Throwable ignored) {
groupsV2Operations = null;
}
this.accountManager = new SignalServiceAccountManager(serviceEnvironmentConfig.signalServiceConfiguration(), this.accountManager = new SignalServiceAccountManager(serviceEnvironmentConfig.signalServiceConfiguration(),
new DynamicCredentialsProvider( new DynamicCredentialsProvider(
// Using empty UUID, because registering doesn't work otherwise // Using empty UUID, because registering doesn't work otherwise
@ -210,7 +206,7 @@ public class RegistrationManagerImpl implements RegistrationManager {
final var accountManager = new SignalServiceAccountManager(serviceEnvironmentConfig.signalServiceConfiguration(), final var accountManager = new SignalServiceAccountManager(serviceEnvironmentConfig.signalServiceConfiguration(),
account.getCredentialsProvider(), account.getCredentialsProvider(),
userAgent, userAgent,
null, groupsV2Operations,
ServiceConfig.AUTOMATIC_NETWORK_RETRY); ServiceConfig.AUTOMATIC_NETWORK_RETRY);
accountManager.setAccountAttributes(account.getAccountAttributes(null)); accountManager.setAccountAttributes(account.getAccountAttributes(null));
account.setRegistered(true); account.setRegistered(true);

View file

@ -142,7 +142,7 @@ public class SignalDependencies {
private ClientZkProfileOperations getClientZkProfileOperations() { private ClientZkProfileOperations getClientZkProfileOperations() {
final var clientZkOperations = getClientZkOperations(); final var clientZkOperations = getClientZkOperations();
return clientZkOperations == null ? null : clientZkOperations.getProfileOperations(); return clientZkOperations.getProfileOperations();
} }
public SignalWebSocket getSignalWebSocket() { public SignalWebSocket getSignalWebSocket() {