aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-07-03 21:32:46 +0200
committerDaniel Gultsch <daniel@gultsch.de>2015-07-03 21:32:46 +0200
commitd30fb6f0a15fe574069694732bb23c339f0c30d1 (patch)
tree6d66b2cc23c16daf1044e773bd37ce0963ac281b /src
parent1c86098f3b4360eae76f39359281dbdf88321d9f (diff)
avoid very rare npe
Diffstat (limited to 'src')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Roster.java3
-rw-r--r--src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Roster.java b/src/main/java/eu/siacs/conversations/entities/Roster.java
index d6777ef63..628a31d1c 100644
--- a/src/main/java/eu/siacs/conversations/entities/Roster.java
+++ b/src/main/java/eu/siacs/conversations/entities/Roster.java
@@ -74,6 +74,9 @@ public class Roster {
}
public void initContact(final Contact contact) {
+ if (contact == null) {
+ return;
+ }
contact.setAccount(account);
contact.setOption(Contact.Options.IN_ROSTER);
synchronized (this.contacts) {
diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
index ed88e434e..d11b02fa4 100644
--- a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
@@ -386,8 +386,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor;
String args[] = { roster.getAccount().getUuid() };
- cursor = db.query(Contact.TABLENAME, null, Contact.ACCOUNT + "=?",
- args, null, null, null);
+ cursor = db.query(Contact.TABLENAME, null, Contact.ACCOUNT + "=?", args, null, null, null);
while (cursor.moveToNext()) {
roster.initContact(Contact.fromCursor(cursor));
}