Merge pull request #4375 from k9mail/fix_add_identity_crash
Fix crash when trying to create a new identity
This commit is contained in:
commit
615cad7414
1 changed files with 5 additions and 9 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue