diff options
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java index cc4e2a4a..3213fd2e 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java @@ -63,6 +63,7 @@ public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnB private ProgressDialog bindingDialog; + private boolean registered; public static final int REQUEST_CODE_SIGN = 9910; public static final int REQUEST_CODE_ENCRYPT = 9911; @@ -90,6 +91,8 @@ public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnB accountName = settings.getString("openpgp_account_name", ""); keyIDs = settings.getString("openpgp_key_ids", ""); + registered = false; + if (TextUtils.isEmpty(providerPackageName)) { Toast.makeText(this, "No OpenPGP Provider selected!", Toast.LENGTH_LONG).show(); Intent intent = new Intent(this, UserPreference.class); @@ -110,6 +113,8 @@ public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnB bindingDialog.setCancelable(false); bindingDialog.show(); + registered = true; + ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); } @@ -118,7 +123,7 @@ public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnB @Override public void onStop(){ super.onStop(); - if (this.mServiceConnection.isBound()) + if (this.registered && this.mServiceConnection.isBound()) try { this.mServiceConnection.unbindFromService(); } catch (Exception e){ |