handle activeSubscriptionInfoList returning null
This commit is contained in:
parent
64bb563ef6
commit
98a7095324
|
@ -274,7 +274,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
|
||||
@SuppressLint("MissingPermission")
|
||||
private fun setupSIMSelector() {
|
||||
val availableSIMs = SubscriptionManager.from(this).activeSubscriptionInfoList
|
||||
val availableSIMs = SubscriptionManager.from(this).activeSubscriptionInfoList ?: return
|
||||
if (availableSIMs.size > 1) {
|
||||
availableSIMs.forEachIndexed { index, subscriptionInfo ->
|
||||
var label = subscriptionInfo.displayName.toString()
|
||||
|
@ -376,7 +376,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
|
||||
val subscriptionIdToSimId = HashMap<Int, String>()
|
||||
subscriptionIdToSimId[-1] = "?"
|
||||
SubscriptionManager.from(this).activeSubscriptionInfoList.forEachIndexed { index, subscriptionInfo ->
|
||||
SubscriptionManager.from(this).activeSubscriptionInfoList?.forEachIndexed { index, subscriptionInfo ->
|
||||
subscriptionIdToSimId[subscriptionInfo.subscriptionId] = "${index + 1}"
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.simplemobiletools.smsmessenger.adapters
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.net.Uri
|
||||
|
@ -43,7 +44,8 @@ class ThreadAdapter(activity: SimpleActivity, var messages: ArrayList<ThreadItem
|
|||
itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {
|
||||
|
||||
private val roundedCornersRadius = resources.getDimension(R.dimen.normal_margin).toInt()
|
||||
private val hasMultipleSIMCards = SubscriptionManager.from(activity).activeSubscriptionInfoList.size > 1
|
||||
@SuppressLint("MissingPermission")
|
||||
private val hasMultipleSIMCards = SubscriptionManager.from(activity).activeSubscriptionInfoList?.size ?: 0 > 1
|
||||
|
||||
init {
|
||||
setupDragListener(true)
|
||||
|
|
Loading…
Reference in New Issue