Catch NPE on webLogin view binding

Resolves: #1958

Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
Tim Krüger 2022-05-03 12:03:32 +02:00 committed by Marcel Hibbe
parent 2fc5545576
commit ff5f686d7c
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -30,6 +30,7 @@ import android.os.Bundle
import android.security.KeyChain
import android.security.KeyChainException
import android.text.TextUtils
import android.util.Log
import android.view.View
import android.webkit.ClientCertRequest
import android.webkit.CookieSyncManager
@ -77,7 +78,6 @@ import java.net.URLDecoder
import java.security.PrivateKey
import java.security.cert.CertificateException
import java.security.cert.X509Certificate
import java.util.HashMap
import java.util.Locale
import javax.inject.Inject
@ -183,6 +183,7 @@ class WebViewLoginController(args: Bundle? = null) : NewBaseController(
}
override fun onPageFinished(view: WebView, url: String) {
try {
loginStep++
if (!basePageLoaded) {
binding.progressBar.visibility = View.GONE
@ -209,6 +210,12 @@ class WebViewLoginController(args: Bundle? = null) : NewBaseController(
}
}
}
} catch (npe: NullPointerException) {
// view binding can be null
// since this is called asynchronously and UI might have been destroyed in the meantime
Log.i(TAG, "UI destroyed - view binding already gone")
}
super.onPageFinished(view, url)
}