mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
Catch NPE on ServerSelection view binding
Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
parent
b60de3858b
commit
8e981f04b0
@ -21,12 +21,14 @@
|
|||||||
*/
|
*/
|
||||||
package com.nextcloud.talk.controllers
|
package com.nextcloud.talk.controllers
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.ActivityInfo
|
import android.content.pm.ActivityInfo
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.security.KeyChain
|
import android.security.KeyChain
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
|
import android.util.Log
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
@ -188,8 +190,10 @@ class ServerSelectionController :
|
|||||||
binding.certTextView.setOnClickListener { onCertClick() }
|
binding.certTextView.setOnClickListener { onCertClick() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("LongLogTag")
|
||||||
private fun checkServerAndProceed() {
|
private fun checkServerAndProceed() {
|
||||||
dispose()
|
dispose()
|
||||||
|
try {
|
||||||
var url: String = binding.serverEntryTextInputEditText.text.toString().trim { it <= ' ' }
|
var url: String = binding.serverEntryTextInputEditText.text.toString().trim { it <= ' ' }
|
||||||
binding.serverEntryTextInputEditText.isEnabled = false
|
binding.serverEntryTextInputEditText.isEnabled = false
|
||||||
showserverEntryProgressBar()
|
showserverEntryProgressBar()
|
||||||
@ -206,6 +210,11 @@ class ServerSelectionController :
|
|||||||
} else {
|
} else {
|
||||||
checkServer("https://$queryUrl", true)
|
checkServer("https://$queryUrl", true)
|
||||||
}
|
}
|
||||||
|
} 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")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkServer(queryUrl: String, checkForcedHttps: Boolean) {
|
private fun checkServer(queryUrl: String, checkForcedHttps: Boolean) {
|
||||||
|
Loading…
Reference in New Issue
Block a user