From 26e03137cd390b20548cdd785f48bc9cfd86c44a Mon Sep 17 00:00:00 2001 From: dankito Date: Wed, 30 Sep 2020 02:41:05 +0200 Subject: [PATCH] Fixed that when fintsBank could not get restored and then addAccount() fails (e.g. due to no network connection), then fintsBank contains almost no data which then got mapped to bank --- .../kotlin/net/dankito/banking/fints4kBankingClient.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt b/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt index 5f6af5f8..e75d22e5 100644 --- a/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt +++ b/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt @@ -67,7 +67,10 @@ open class fints4kBankingClient( protected open fun handleAddAccountResponse(response: net.dankito.banking.fints.response.client.AddAccountResponse, callback: (AddAccountResponse) -> Unit) { - mapper.mapBank(bank, fintsBank) + if (response.successful) { // if fintsBank couldn't be restored and then an error occurs, e.g. no network connection, then fintsBank contains almost no data which then gets mapped to bank -> accounts, TAN methods, TAN procedures, ... are lost + mapper.mapBank(bank, fintsBank) + } + val mappedResponse = mapper.mapResponse(bank, response) saveData()