diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-10-20 21:47:44 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-10-20 21:47:44 +0200 |
commit | 3186893cfd4626173a758487fc49810d0aa419ac (patch) | |
tree | 795c056a8a3596e12404cb8588da68ce7aebedeb /src | |
parent | a19b47119bebf1990ed239ed028faf28c2aff101 (diff) |
fixed NPE after attempt to store user@ip style jid resolver result
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/utils/Resolver.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/Resolver.java b/src/main/java/de/pixart/messenger/utils/Resolver.java index a1bd22d36..7817e7914 100644 --- a/src/main/java/de/pixart/messenger/utils/Resolver.java +++ b/src/main/java/de/pixart/messenger/utils/Resolver.java @@ -301,7 +301,8 @@ public class Resolver { } catch (UnknownHostException e) { result.ip = null; } - result.hostname = DNSName.from(cursor.getString(cursor.getColumnIndex(HOSTNAME))); + final String hostname = cursor.getString(cursor.getColumnIndex(HOSTNAME)); + result.hostname = hostname == null ? null : DNSName.from(hostname); result.port = cursor.getInt(cursor.getColumnIndex(PORT)); result.priority = cursor.getInt(cursor.getColumnIndex(PRIORITY)); result.authenticated = cursor.getInt(cursor.getColumnIndex(AUTHENTICATED)) > 0; @@ -393,7 +394,7 @@ public class Resolver { public ContentValues toContentValues() { final ContentValues contentValues = new ContentValues(); contentValues.put(IP, ip == null ? null : ip.getAddress()); - contentValues.put(HOSTNAME, hostname.toString()); + contentValues.put(HOSTNAME, hostname == null ? null : hostname.toString()); contentValues.put(PORT, port); contentValues.put(PRIORITY, priority); contentValues.put(DIRECT_TLS, directTls ? 1 : 0); |