diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-04-26 20:21:09 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-04-26 20:21:09 +0200 |
commit | 89e92e1085c70ad55ee820477c8c002999c9ddbb (patch) | |
tree | e3d7fbb5c3d5871eb5d11a97d96a9bcfc694572f /src/main | |
parent | 1a844e3cd5dc1ce87eda13e5902f7bad31a918df (diff) |
while restoring state deal with conversations that don't have accounts
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 73c5039c6..a98f84336 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -1560,9 +1560,15 @@ public class XmppConnectionService extends Service { accountLookupTable.put(account.getUuid(), account); } this.conversations.addAll(databaseBackend.getConversations(Conversation.STATUS_AVAILABLE)); - for (Conversation conversation : this.conversations) { + for (Iterator<Conversation> iterator = conversations.listIterator(); iterator.hasNext(); ) { + Conversation conversation = iterator.next(); Account account = accountLookupTable.get(conversation.getAccountUuid()); - conversation.setAccount(account); + if (account != null) { + conversation.setAccount(account); + } else { + Log.e(Config.LOGTAG, "unable to restore Conversations with " + conversation.getJid()); + iterator.remove(); + } } Runnable runnable = new Runnable() { @Override |