From 482357db96cb41c0f8d0c9fac1dc0fb3820ee391 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 20 Jul 2021 23:20:05 -0700 Subject: Fix crashes --- app/src/google/java/org/traccar/manager/GoogleMainApplication.kt | 2 +- app/src/main/java/org/traccar/manager/MainFragment.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/src/google/java/org/traccar/manager/GoogleMainApplication.kt b/app/src/google/java/org/traccar/manager/GoogleMainApplication.kt index cfeaf6e..1c28987 100644 --- a/app/src/google/java/org/traccar/manager/GoogleMainApplication.kt +++ b/app/src/google/java/org/traccar/manager/GoogleMainApplication.kt @@ -49,7 +49,7 @@ class GoogleMainApplication : Application() { private val broadcastReceiver: BroadcastReceiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { FirebaseMessaging.getInstance().token.addOnCompleteListener { - if (it.isComplete) { + if (it.isSuccessful) { broadcastToken(it.result) } } diff --git a/app/src/main/java/org/traccar/manager/MainFragment.kt b/app/src/main/java/org/traccar/manager/MainFragment.kt index 8aa0c15..2675d0c 100644 --- a/app/src/main/java/org/traccar/manager/MainFragment.kt +++ b/app/src/main/java/org/traccar/manager/MainFragment.kt @@ -102,9 +102,9 @@ class MainFragment : WebViewFragment() { private var openFileCallback: ValueCallback? = null private var openFileCallback2: ValueCallback>? = null - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) { + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { if (requestCode == REQUEST_FILE_CHOOSER) { - val result = if (resultCode != Activity.RESULT_OK) null else data.data + val result = if (resultCode != Activity.RESULT_OK) null else data?.data if (openFileCallback != null) { openFileCallback?.onReceiveValue(result) openFileCallback = null -- cgit v1.2.3