diff options
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index c34afff07..bf4ffcd0a 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -1322,13 +1322,15 @@ public class XmppConnectionService extends Service { private void logoutAndSave(boolean stop) { int activeAccounts = 0; - for (final Account account : accounts) { - if (account.getStatus() != Account.State.DISABLED) { - databaseBackend.writeRoster(account.getRoster()); - activeAccounts++; - } - if (account.getXmppConnection() != null) { - new Thread(() -> disconnect(account, false)).start(); + if (accounts != null) { + for (final Account account : accounts) { + if (account.getStatus() != Account.State.DISABLED) { + databaseBackend.writeRoster(account.getRoster()); + activeAccounts++; + } + if (account.getXmppConnection() != null) { + new Thread(() -> disconnect(account, false)).start(); + } } } if (stop || activeAccounts == 0) { |