Skip to content

Commit

Permalink
Fixed a crash where the active sim list was null on certain devices
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrowlands committed Dec 26, 2023
1 parent 0769808 commit f8cd6ee
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,12 @@ public synchronized void initializeCellularScanningResources()
if (ActivityCompat.checkSelfPermission(surveyService, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED)
{
activeSubscriptionInfoList = subscriptionManager.getActiveSubscriptionInfoList();
if (activeSubscriptionInfoList == null)
{
Timber.i("The returned active subscription info list was null.");
activeSubscriptionInfoList = new ArrayList<>();
}

Timber.i("Found %s active SIMs", activeSubscriptionInfoList.size());

// We only want to use the subscription info list if there are two active SIMs. If there is only
Expand Down Expand Up @@ -450,7 +456,7 @@ public void onReceive(Context context, Intent intent)

/**
* Runs one cellular scan. This is used to prime the UI in the event that the scan interval is really long.
*
* <p>
* Need to synchronize it because we use the resources that are initialized on SIM changes
* such as telephonyManagerList.
*/
Expand Down

0 comments on commit f8cd6ee

Please sign in to comment.