diff --git a/k9mail/src/main/java/com/fsck/k9/Account.java b/k9mail/src/main/java/com/fsck/k9/Account.java index 3a66f88f8..8f85570d9 100644 --- a/k9mail/src/main/java/com/fsck/k9/Account.java +++ b/k9mail/src/main/java/com/fsck/k9/Account.java @@ -1894,9 +1894,15 @@ public class Account implements BaseAccount, StoreConfig { public void deleteCertificates() { LocalKeyStore localKeyStore = LocalKeyStore.getInstance(); - Uri uri = Uri.parse(getStoreUri()); - localKeyStore.deleteCertificate(uri.getHost(), uri.getPort()); - uri = Uri.parse(getTransportUri()); - localKeyStore.deleteCertificate(uri.getHost(), uri.getPort()); + String storeUri = getStoreUri(); + if (storeUri != null) { + Uri uri = Uri.parse(storeUri); + localKeyStore.deleteCertificate(uri.getHost(), uri.getPort()); + } + String transportUri = getTransportUri(); + if (transportUri != null) { + Uri uri = Uri.parse(transportUri); + localKeyStore.deleteCertificate(uri.getHost(), uri.getPort()); + } } }