Repository: thundernest/k-9
Issue: Openpgp enable crash

### Actual behavior
K9 crashes when enabling openpgp support without having a provider installed.

### Steps to reproduce
Click the following:

1. Settings
2. Account
3. End-to-end encryption
4. Enable
5. Install

### Environment
K-9 Mail version: master

Android version:9.0

```
07-23 15:58:10.701  2290  3255 I ActivityManager: START u0 {cmp=com.fsck.k9.debug/com.fsck.k9.ui.settings.account.OpenPgpAppSelectDialog (has extras)} from uid 10101
07-23 15:58:10.755 17399 17399 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@17623b1
07-23 15:58:10.855   564   605 D SurfaceFlinger: duplicate layer name: changing com.fsck.k9.debug/com.fsck.k9.ui.settings.account.OpenPgpAppSelectDialog to com.fsck.k9.debug/com.fsck.k9.ui.settings.account.OpenPgpAppSelectDialog#1
07-23 15:58:11.765  2290  3255 I ActivityManager: START u0 {act=android.intent.action.VIEW dat=market://details?id=org.sufficientlysecure.keychain cmp=android/com.android.internal.app.ResolverActivity} from uid 10101
07-23 15:58:11.778 17399 17435 D OpenGLRenderer: endAllActiveAnimators on 0x74bec6d500 (RippleDrawable) with handle 0x74c1635480
07-23 15:58:11.788 17315 17315 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@b317974
07-23 15:58:11.799 17399 17399 D AndroidRuntime: Shutting down VM
07-23 15:58:11.800 17399 17399 E AndroidRuntime: FATAL EXCEPTION: main
07-23 15:58:11.800 17399 17399 E AndroidRuntime: Process: com.fsck.k9.debug, PID: 17399
07-23 15:58:11.800 17399 17399 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.fragment.app.FragmentActivity.finish()' on a null object reference
07-23 15:58:11.800 17399 17399 E AndroidRuntime: 	at com.fsck.k9.ui.settings.account.OpenPgpAppSelectDialog$OpenKeychainInfoFragment.onDismiss(OpenPgpAppSelectDialog.java:327)
07-23 15:58:11.800 17399 17399 E AndroidRuntime: 	at android.app.Dialog$ListenersHandler.handleMessage(Dialog.java:1393)
07-23 15:58:11.800 17399 17399 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
07-23 15:58:11.800 17399 17399 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:193)
07-23 15:58:11.800 17399 17399 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6718)
07-23 15:58:11.800 17399 17399 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
07-23 15:58:11.800 17399 17399 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
07-23 15:58:11.800 17399 17399 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
07-23 15:58:11.805  2290  2396 I ActivityManager: Showing crash dialog for package com.fsck.k9.debug u0
```

Changed files:
app/ui/src/main/java/com/fsck/k9/ui/settings/account/OpenPgpAppSelectDialog.java

diff --git a/app/ui/src/main/java/com/fsck/k9/ui/settings/account/OpenPgpAppSelectDialog.java b/app/ui/src/main/java/com/fsck/k9/ui/settings/account/OpenPgpAppSelectDialog.java
index d94bc56b8..376f8b0fb 100644
--- a/app/ui/src/main/java/com/fsck/k9/ui/settings/account/OpenPgpAppSelectDialog.java
+++ b/app/ui/src/main/java/com/fsck/k9/ui/settings/account/OpenPgpAppSelectDialog.java
@@ -297,8 +297,8 @@ public class OpenPgpAppSelectDialog extends FragmentActivity {
             builder.setPositiveButton(R.string.dialog_openkeychain_info_install, new OnClickListener() {
                 @Override
                 public void onClick(DialogInterface dialogInterface, int i) {
-                    startOpenKeychainInstallActivity();
                     dismiss();
+                    startOpenKeychainInstallActivity();
                 }
             });