From ed5d4bb24119be5b85842728b7956840dd23ea7e Mon Sep 17 00:00:00 2001 From: dankito Date: Thu, 14 May 2020 22:27:49 +0200 Subject: [PATCH] Fixed that at view initialization window is still null and therefore call to currentStage for dialogService.showErrorMessage() crashes --- .../banking/ui/javafx/dialogs/tan/EnterTanDialog.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/EnterTanDialog.kt b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/EnterTanDialog.kt index 1d8a4c3c..dc7af106 100644 --- a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/EnterTanDialog.kt +++ b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/EnterTanDialog.kt @@ -97,7 +97,7 @@ open class EnterTanDialog( } } else { - showDecodingTanChallengeFailedError(flickerCode.decodingError) + showDecodingTanChallengeFailedErrorOnViewInitialization(flickerCode.decodingError) } } @@ -113,7 +113,7 @@ open class EnterTanDialog( }) } else { - showDecodingTanChallengeFailedError(decodedImage.decodingError) + showDecodingTanChallengeFailedErrorOnViewInitialization(decodedImage.decodingError) } } @@ -184,6 +184,12 @@ open class EnterTanDialog( } + protected open fun showDecodingTanChallengeFailedErrorOnViewInitialization(error: Exception?) { + runLater { + showDecodingTanChallengeFailedError(error) + } + } + protected open fun showDecodingTanChallengeFailedError(error: Exception?) { dialogService.showErrorMessage(String.format(messages["enter.tan.dialog.error.could.not.decode.tan.image"], error?.localizedMessage), null, error, currentStage)