mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-25 09:17:58 +00:00
Added fail-safe
This commit is contained in:
parent
d8bb432037
commit
ca77d6c6c6
1 changed files with 8 additions and 3 deletions
|
@ -1550,8 +1550,12 @@ public class FragmentCompose extends FragmentBase {
|
||||||
|
|
||||||
EntityIdentity identity = db.identity().getIdentity(draft.identity);
|
EntityIdentity identity = db.identity().getIdentity(draft.identity);
|
||||||
if (identity != null && identity.sign_key_alias != null)
|
if (identity != null && identity.sign_key_alias != null)
|
||||||
args.putBoolean("selected",
|
try {
|
||||||
KeyChain.getPrivateKey(context, identity.sign_key_alias) != null);
|
PrivateKey key = KeyChain.getPrivateKey(context, identity.sign_key_alias);
|
||||||
|
args.putBoolean("available", key != null);
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.w(ex);
|
||||||
|
}
|
||||||
|
|
||||||
return identity;
|
return identity;
|
||||||
}
|
}
|
||||||
|
@ -1561,7 +1565,8 @@ public class FragmentCompose extends FragmentBase {
|
||||||
if (identity == null)
|
if (identity == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (args.getBoolean("selected")) {
|
boolean available = args.getBoolean("available");
|
||||||
|
if (available) {
|
||||||
args.putString("alias", identity.sign_key_alias);
|
args.putString("alias", identity.sign_key_alias);
|
||||||
onSmime(args, action);
|
onSmime(args, action);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue