aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/persistance
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-05-16 21:45:29 +0200
committerChristian Schneppe <christian@pix-art.de>2018-05-16 21:45:29 +0200
commitf8ec77ab9689193e366eb3aed51cb17d1ccbd986 (patch)
tree6c95907b7c1ccd27d6d18461dfc7ad7357fe89aa /src/main/java/de/pixart/messenger/persistance
parent0525b1f960f4d7b45940bfe4a88beac99e571363 (diff)
do not load conversations with null jid
Diffstat (limited to 'src/main/java/de/pixart/messenger/persistance')
-rw-r--r--src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
index 7d9c38718..dab6dde5d 100644
--- a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
@@ -52,6 +52,7 @@ import de.pixart.messenger.services.ShortcutService;
import de.pixart.messenger.utils.CryptoHelper;
import de.pixart.messenger.utils.FtsUtils;
import de.pixart.messenger.utils.Resolver;
+import de.pixart.messenger.xmpp.InvalidJid;
import de.pixart.messenger.xmpp.mam.MamReference;
import rocks.xmpp.addr.Jid;
@@ -692,10 +693,14 @@ public class DatabaseBackend extends SQLiteOpenHelper {
SQLiteDatabase db = this.getReadableDatabase();
String[] selectionArgs = {Integer.toString(status)};
Cursor cursor = db.rawQuery("select * from " + Conversation.TABLENAME
- + " where " + Conversation.STATUS + " = ? order by "
+ + " where " + Conversation.STATUS + " = ? and "+Conversation.CONTACTJID+" is not null order by "
+ Conversation.CREATED + " desc", selectionArgs);
while (cursor.moveToNext()) {
- list.add(Conversation.fromCursor(cursor));
+ final Conversation conversation = Conversation.fromCursor(cursor);
+ if (conversation.getJid() instanceof InvalidJid) {
+ continue;
+ }
+ list.add(conversation);
}
cursor.close();
return list;
@@ -793,6 +798,9 @@ public class DatabaseBackend extends SQLiteOpenHelper {
cursor.moveToFirst();
Conversation conversation = Conversation.fromCursor(cursor);
cursor.close();
+ if (conversation.getJid() instanceof InvalidJid) {
+ return null;
+ }
return conversation;
}