diff --git a/app/src/main/java/org/shadowice/flocke/andotp/Activities/MainActivity.java b/app/src/main/java/org/shadowice/flocke/andotp/Activities/MainActivity.java index e955a5cf..3fa4cb9e 100644 --- a/app/src/main/java/org/shadowice/flocke/andotp/Activities/MainActivity.java +++ b/app/src/main/java/org/shadowice/flocke/andotp/Activities/MainActivity.java @@ -422,15 +422,18 @@ public class MainActivity extends BaseActivity encryptionKey = KeyStoreHelper.loadEncryptionKeyFromKeyStore(this); } else if (encryptionType == Constants.EncryptionType.PASSWORD) { byte[] credentialSeed = intent.getByteArrayExtra(EXTRA_NAME_PASSWORD_KEY); - encryptionKey = EncryptionHelper.generateSymmetricKey(credentialSeed); + if (credentialSeed != null && credentialSeed.length > 0) + encryptionKey = EncryptionHelper.generateSymmetricKey(credentialSeed); } boolean saveDatabase = intent.getBooleanExtra(EXTRA_NAME_SAVE_DATABASE, false); - adapter.setEncryptionKey(encryptionKey); + if (encryptionKey != null) { + adapter.setEncryptionKey(encryptionKey); - if (saveDatabase) - adapter.saveEntries(); + if (saveDatabase) + adapter.saveEntries(); + } populateAdapter(); }