From 225402f2c26240f65df03ea4bd4414e8ea8e1f63 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Sat, 24 Nov 2018 04:56:56 +0200 Subject: [PATCH] - fixed crash when empty accounts spinner is clicked --- app/build.gradle | 4 ++-- app/src/main/cpp/baresip.c | 5 ++--- app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt | 2 -- app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt | 4 ++++ 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index bcb6689d..b2f720ca 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId = 'com.tutpro.baresip' minSdkVersion 21 targetSdkVersion 27 - versionCode = 35 - versionName = '4.1.1' + versionCode = 36 + versionName = '4.1.2' externalNativeBuild { cmake { cFlags '-DHAVE_INTTYPES_H' diff --git a/app/src/main/cpp/baresip.c b/app/src/main/cpp/baresip.c index 038886fe..a207a9cf 100644 --- a/app/src/main/cpp/baresip.c +++ b/app/src/main/cpp/baresip.c @@ -154,9 +154,6 @@ static void ua_event_handler(struct ua *ua, enum ua_event ev, case UA_EVENT_AUDIO_ERROR: mem_deref(call); return; - case UA_EVENT_EXIT: - re_snprintf(event_buf, sizeof event_buf, "%s", "exit"); - break; default: return; } @@ -419,6 +416,8 @@ Java_com_tutpro_baresip_BaresipService_baresipStart(JNIEnv *env, jobject instanc if (err) { LOGE("stopping UAs due to error: (%d)\n", err); ua_stop_all(true); + } else { + LOGI("main loop exit\n"); } play = mem_deref(play); diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index fa722bd4..35a4127c 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -239,8 +239,6 @@ class BaresipService: Service() { fun uaEvent(event: String, uap: String, callp: String) { Log.d(LOG_TAG, "uaEvent got event $event/$uap/$callp") if (!isServiceRunning) return - if (event == "exit") - return val ua = UserAgent.find(uap) if (ua == null) { Log.w(LOG_TAG, "uaEvent did not find ua $uap") diff --git a/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt b/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt index 74c7a916..d2b60bb9 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt @@ -22,6 +22,7 @@ import android.text.TextWatcher import android.widget.RelativeLayout import android.widget.* import android.view.* + import kotlin.collections.ArrayList class MainActivity : AppCompatActivity() { @@ -138,6 +139,9 @@ class MainActivity : AppCompatActivity() { if (event.action == MotionEvent.ACTION_DOWN) { if (aorSpinner.selectedItemPosition == -1) { val i = Intent(this, AccountsActivity::class.java) + val b = Bundle() + b.putString("accp", "") + i.putExtras(b) startActivityForResult(i, ACCOUNTS_CODE) true } else {