aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian.schneppe@pix-art.de>2019-10-26 20:09:28 +0200
committerChristian Schneppe <christian.schneppe@pix-art.de>2019-10-26 20:09:28 +0200
commit0389f67482e3b79c72682fa445ff17e7aa9031f3 (patch)
tree49c83d8a9e839a5572152ad5b00fa112d989727d
parentc85b487fca553a9c154dc3b1a1c0e7a4a8708108 (diff)
attempt to fix some rare crashes
-rw-r--r--src/main/java/de/pixart/messenger/entities/MucOptions.java2
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java8
2 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/MucOptions.java b/src/main/java/de/pixart/messenger/entities/MucOptions.java
index e73fcfcac..40a0be58d 100644
--- a/src/main/java/de/pixart/messenger/entities/MucOptions.java
+++ b/src/main/java/de/pixart/messenger/entities/MucOptions.java
@@ -336,7 +336,7 @@ public class MucOptions {
}
public boolean isContactInRoom(Contact contact) {
- return findUserByRealJid(contact.getJid().asBareJid()) != null;
+ return contact != null && findUserByRealJid(contact.getJid().asBareJid()) != null;
}
public boolean isUserInRoom(Jid jid) {
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 0ead8c393..e7c587107 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -2198,9 +2198,13 @@ public class XmppConnectionService extends Service {
* This will find all conferences with the contact as member and also the conference that is the contact (that 'fake' contact is used to store the avatar)
*/
public List<Conversation> findAllConferencesWith(Contact contact) {
- ArrayList<Conversation> results = new ArrayList<>();
+ final ArrayList<Conversation> results = new ArrayList<>();
for (final Conversation c : conversations) {
- if (c.getMode() == Conversation.MODE_MULTI && (c.getJid().asBareJid().equals(contact.getJid().asBareJid()) || c.getMucOptions().isContactInRoom(contact))) {
+ if (c.getMode() != Conversation.MODE_MULTI) {
+ continue;
+ }
+ final MucOptions mucOptions = c.getMucOptions();
+ if (c.getJid().asBareJid().equals(contact.getJid().asBareJid()) || (mucOptions != null && mucOptions.isContactInRoom(contact))) {
results.add(c);
}
}