Merge "Fix IndexOutOfBoundsException" into main

This commit is contained in:
Julia Reynolds
2024-07-03 18:01:46 +00:00
committed by Android (Google) Code Review

View File

@@ -105,7 +105,7 @@ class AppNotificationsListModel(
override fun getSpinnerOptions(recordList: List<AppNotificationsRecord>): List<SpinnerOption> {
val options = mutableListOf(SpinnerItem.AllApps, SpinnerItem.TurnedOff)
if (repository.isUserUnlocked(recordList[0].app.userId)) {
if (recordList.isNotEmpty() && repository.isUserUnlocked(recordList[0].app.userId)) {
options.add(0, SpinnerItem.MostRecent)
options.add(1, SpinnerItem.MostFrequent)
}