- Fixed rare crash that can happen when first account is created and

message or call comes in before user has returned to main activity.
This commit is contained in:
Juha Heinanen
2019-03-06 09:35:10 +02:00
parent aa98e04de1
commit 9e6db47da8
3 changed files with 10 additions and 5 deletions

View File

@ -7,8 +7,8 @@ android {
applicationId = 'com.tutpro.baresip'
minSdkVersion 21
targetSdkVersion 27
versionCode = 44
versionName = '5.4.1'
versionCode = 45
versionName = '5.4.2'
externalNativeBuild {
cmake {
cFlags '-DHAVE_INTTYPES_H'

View File

@ -474,7 +474,8 @@ class MainActivity : AppCompatActivity() {
Log.e("Baresip", "Incoming call $callp not found")
return
}
if (ua != UserAgent.uas()[aorSpinner.selectedItemPosition]) {
if ((aorSpinner.selectedItemPosition == -1) ||
(ua != UserAgent.uas()[aorSpinner.selectedItemPosition])) {
aorSpinner.setSelection(account_index)
} else {
callTitle.text = "Incoming call from ..."
@ -655,7 +656,8 @@ class MainActivity : AppCompatActivity() {
Message.add(Message(aor, peerUri, R.drawable.arrow_down_green, msgText,
time.toLong(), true))
if (Utils.isVisible()) {
if (ua != UserAgent.uas()[aorSpinner.selectedItemPosition])
if ((aorSpinner.selectedItemPosition == -1) ||
(ua != UserAgent.uas()[aorSpinner.selectedItemPosition]))
aorSpinner.setSelection(account_index)
val i = Intent(applicationContext, ChatsActivity::class.java)
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
@ -678,11 +680,12 @@ class MainActivity : AppCompatActivity() {
}
}
if ((aorSpinner.selectedItemPosition >= 0) &&
(ua == UserAgent.uas()[aorSpinner.selectedItemPosition]))
(ua == UserAgent.uas()[aorSpinner.selectedItemPosition])) {
if (acc.vmNew > 0)
voicemailButton.setImageResource(R.drawable.voicemail_new)
else
voicemailButton.setImageResource(R.drawable.voicemail)
}
}
else -> Log.w("Baresip", "Unknown event '${ev[0]}'")
}

View File

@ -0,0 +1,2 @@
- Fixed rare crash that can happen when first account is created and
message or call comes in before user has returned to main activity.