- Fixed crash when stun server is defined without port number.

This commit is contained in:
Juha Heinanen
2019-03-21 09:04:24 +02:00
parent 10f7db4248
commit 532bc23ebd
4 changed files with 11 additions and 11 deletions

View File

@ -264,25 +264,24 @@ class AccountActivity : AppCompatActivity() {
if (iceCheck.isChecked) {
val newStunServer = stunServer.text.toString().trim()
if (acc.stunServer != newStunServer) {
if ((newStunServer != "") &&
!Utils.checkHostPort(newStunServer, false)) {
if (!Utils.checkHostPort(newStunServer, false)) {
Utils.alertView(this, "Notice",
"Invalid STUN Server: $newStunServer")
"Invalid STUN Server '$newStunServer'")
return false
}
var host = ""
var port = ""
var port = 0
if (newStunServer != "") {
val hostPort = newStunServer.split(":")
host = hostPort[0]
if (hostPort.size == 2) port = hostPort[1]
if (hostPort.size == 2) port = hostPort[1].toInt()
}
if ((account_set_stun_host(acc.accp, host) == 0) &&
(account_set_stun_port(acc.accp, port.toInt()) == 0)) {
(account_set_stun_port(acc.accp, port) == 0)) {
acc.stunServer = account_stun_host(acc.accp)
if (port != "")
if (port != 0)
acc.stunServer += ":" + account_stun_port(acc.accp).toString()
Log.d("Baresip", "New StunServer is ${acc.stunServer}")
Log.d("Baresip", "New StunServer is '${acc.stunServer}'")
save = true
} else {
Log.e("Baresip", "Setting of StunServer failed")

View File

@ -114,7 +114,7 @@ class ChatActivity : AppCompatActivity() {
}
newMessage = findViewById(R.id.text) as EditText
newMessage.setOnFocusChangeListener(View.OnFocusChangeListener { v, hasFocus ->
newMessage.setOnFocusChangeListener(View.OnFocusChangeListener { _, hasFocus ->
if (hasFocus) {
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
}