fix NPE for viewbinding

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2022-05-06 14:58:30 +02:00
parent aa38df61be
commit 30f65424a5
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -347,15 +347,22 @@ class ServerSelectionController :
setCertTextView() setCertTextView()
} }
@SuppressLint("LongLogTag")
private fun setCertTextView() { private fun setCertTextView() {
if (activity != null) { if (activity != null) {
activity!!.runOnUiThread { activity!!.runOnUiThread {
try {
if (!TextUtils.isEmpty(appPreferences!!.temporaryClientCertAlias)) { if (!TextUtils.isEmpty(appPreferences!!.temporaryClientCertAlias)) {
binding.certTextView.setText(R.string.nc_change_cert_auth) binding.certTextView.setText(R.string.nc_change_cert_auth)
} else { } else {
binding.certTextView.setText(R.string.nc_configure_cert_auth) binding.certTextView.setText(R.string.nc_configure_cert_auth)
} }
hideserverEntryProgressBar() hideserverEntryProgressBar()
} catch (npe: java.lang.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")
}
} }
} }
} }