mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 06:01:12 +00:00
Cancel encryption on no key
This commit is contained in:
parent
19ad6e88b0
commit
916993fca4
1 changed files with 5 additions and 2 deletions
|
@ -53,6 +53,7 @@ import android.os.Build;
|
|||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.LocaleList;
|
||||
import android.os.OperationCanceledException;
|
||||
import android.provider.ContactsContract;
|
||||
import android.provider.MediaStore;
|
||||
import android.text.Html;
|
||||
|
@ -1581,7 +1582,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
pgpKeyIds = result.getLongArrayExtra(OpenPgpApi.EXTRA_KEY_IDS);
|
||||
Log.i("Keys=" + pgpKeyIds.length);
|
||||
if (pgpKeyIds.length == 0)
|
||||
throw new IllegalStateException("Got no key");
|
||||
throw new OperationCanceledException("Got no key");
|
||||
|
||||
// Get encrypt key
|
||||
if (pgpKeyIds.length == 1) {
|
||||
|
@ -1680,7 +1681,9 @@ public class FragmentCompose extends FragmentBase {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
if (ex instanceof IllegalArgumentException) {
|
||||
if (ex instanceof OperationCanceledException)
|
||||
; // Do nothing
|
||||
else if (ex instanceof IllegalArgumentException) {
|
||||
Log.i(ex);
|
||||
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
||||
} else
|
||||
|
|
Loading…
Reference in a new issue