aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-01-26 23:09:42 +0100
committerChristian Schneppe <christian@pix-art.de>2019-01-26 23:09:42 +0100
commit439a61a75ab4a7d9792d2aac9f821588a2a2a07e (patch)
tree727f5d0f3fd9f0f986fc37d6e0b0d710f2d908c0
parentce1302eec044d381e9781c3abe8211bc2d42d60a (diff)
fix crash while onTaskRemoved
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java16
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) {