- 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

@ -7,8 +7,8 @@ android {
applicationId = 'com.tutpro.baresip' applicationId = 'com.tutpro.baresip'
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 27 targetSdkVersion 27
versionCode = 47 versionCode = 48
versionName = '6.0.1' versionName = '6.0.2'
externalNativeBuild { externalNativeBuild {
cmake { cmake {
cFlags '-DHAVE_INTTYPES_H' cFlags '-DHAVE_INTTYPES_H'

View File

@ -264,25 +264,24 @@ class AccountActivity : AppCompatActivity() {
if (iceCheck.isChecked) { if (iceCheck.isChecked) {
val newStunServer = stunServer.text.toString().trim() val newStunServer = stunServer.text.toString().trim()
if (acc.stunServer != newStunServer) { if (acc.stunServer != newStunServer) {
if ((newStunServer != "") && if (!Utils.checkHostPort(newStunServer, false)) {
!Utils.checkHostPort(newStunServer, false)) {
Utils.alertView(this, "Notice", Utils.alertView(this, "Notice",
"Invalid STUN Server: $newStunServer") "Invalid STUN Server '$newStunServer'")
return false return false
} }
var host = "" var host = ""
var port = "" var port = 0
if (newStunServer != "") { if (newStunServer != "") {
val hostPort = newStunServer.split(":") val hostPort = newStunServer.split(":")
host = hostPort[0] 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) && 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) acc.stunServer = account_stun_host(acc.accp)
if (port != "") if (port != 0)
acc.stunServer += ":" + account_stun_port(acc.accp).toString() 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 save = true
} else { } else {
Log.e("Baresip", "Setting of StunServer failed") Log.e("Baresip", "Setting of StunServer failed")

View File

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

View File

@ -0,0 +1 @@
- Fixed crash when stun server is defined without port number.