From 9f3fd02e3401627d0db072b4dacf36c01b2671a0 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 14 Mar 2019 17:52:15 +0000 Subject: [PATCH] Prevent crash --- app/src/main/java/eu/faircode/email/EntityAccount.java | 4 ++-- app/src/main/java/eu/faircode/email/EntityFolder.java | 2 +- .../main/java/eu/faircode/email/EntityIdentity.java | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EntityAccount.java b/app/src/main/java/eu/faircode/email/EntityAccount.java index fb9494defa..fd748bbe8a 100644 --- a/app/src/main/java/eu/faircode/email/EntityAccount.java +++ b/app/src/main/java/eu/faircode/email/EntityAccount.java @@ -162,7 +162,7 @@ public class EntityAccount implements Serializable { if (json.has("realm")) account.realm = json.getString("realm"); - if (json.has("name")) + if (json.has("name") && !json.isNull("name")) account.name = json.getString("name"); if (json.has("color")) account.color = json.getInt("color"); @@ -180,7 +180,7 @@ public class EntityAccount implements Serializable { account.swipe_right = json.getLong("swipe_right"); account.poll_interval = json.getInt("poll_interval"); - if (json.has("prefix")) + if (json.has("prefix") && !json.isNull("prefix")) account.prefix = json.getString("prefix"); return account; diff --git a/app/src/main/java/eu/faircode/email/EntityFolder.java b/app/src/main/java/eu/faircode/email/EntityFolder.java index 9f00c28f47..291ef2e6f6 100644 --- a/app/src/main/java/eu/faircode/email/EntityFolder.java +++ b/app/src/main/java/eu/faircode/email/EntityFolder.java @@ -322,7 +322,7 @@ public class EntityFolder implements Serializable { else folder.keep_days = folder.sync_days; - if (json.has("display")) + if (json.has("display") && !json.isNull("display")) folder.display = json.getString("display"); if (json.has("hide")) diff --git a/app/src/main/java/eu/faircode/email/EntityIdentity.java b/app/src/main/java/eu/faircode/email/EntityIdentity.java index 9d41d4eb41..831b1d5309 100644 --- a/app/src/main/java/eu/faircode/email/EntityIdentity.java +++ b/app/src/main/java/eu/faircode/email/EntityIdentity.java @@ -141,11 +141,11 @@ public class EntityIdentity { // id identity.name = json.getString("name"); identity.email = json.getString("email"); - if (json.has("display")) + if (json.has("display") && !json.isNull("display")) identity.display = json.getString("display"); if (json.has("color")) identity.color = json.getInt("color"); - if (json.has("signature")) + if (json.has("signature") && !json.isNull("signature")) identity.signature = json.getString("signature"); identity.auth_type = json.getInt("auth_type"); @@ -155,7 +155,7 @@ public class EntityIdentity { identity.port = json.getInt("port"); identity.user = json.getString("user"); identity.password = json.getString("password"); - if (json.has("realm")) + if (json.has("realm") && !json.isNull("realm")) identity.realm = json.getString("realm"); if (json.has("use_ip")) identity.use_ip = json.getBoolean("use_ip"); @@ -163,9 +163,9 @@ public class EntityIdentity { identity.synchronize = json.getBoolean("synchronize"); identity.primary = json.getBoolean("primary"); - if (json.has("replyto")) + if (json.has("replyto") && !json.isNull("replyto")) identity.replyto = json.getString("replyto"); - if (json.has("bcc")) + if (json.has("bcc") && !json.isNull("bcc")) identity.bcc = json.getString("bcc"); if (json.has("plain_only"))