Merge pull request #4375 from k9mail/fix_add_identity_crash

Fix crash when trying to create a new identity
This commit is contained in:
cketti 2019-12-17 02:34:59 +01:00 committed by GitHub
commit 615cad7414
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,20 +15,16 @@ class EditIdentity : K9Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setLayout(R.layout.edit_identity)
identity = intent.getParcelableExtra(EXTRA_IDENTITY)
identityIndex = intent.getIntExtra(EXTRA_IDENTITY_INDEX, -1)
val accountUuid = intent.getStringExtra(EXTRA_ACCOUNT)
account = Preferences.getPreferences(this).getAccount(accountUuid)
if (identityIndex == -1) {
identity = Identity()
}
setLayout(R.layout.edit_identity)
savedInstanceState?.getParcelable<Identity>(EXTRA_IDENTITY)?.let {
identity = it
identity = when {
savedInstanceState != null -> savedInstanceState.getParcelable(EXTRA_IDENTITY) ?: error("Missing state")
identityIndex != -1 -> intent.getParcelableExtra(EXTRA_IDENTITY) ?: error("Missing argument")
else -> Identity()
}
description.setText(identity.description)