Fixed crash when last tab selected was an empty tab

This commit is contained in:
Abdelilah El Aissaoui 2024-08-02 22:33:30 +02:00
parent 3a45d40d66
commit fbe1dd3d9e
No known key found for this signature in database
GPG Key ID: 7587FC860F594869

View File

@ -43,8 +43,8 @@ class TabsManager @Inject constructor(
val latestSelectedTabIndex = appSettingsRepository.latestRepositoryTabSelected
_currentTab.value = when(latestSelectedTabIndex < 0) {
true -> _tabsFlow.value.first()
false -> tabsFlow.value[latestSelectedTabIndex]
true -> tabsFlow.value.first()
false -> tabsFlow.value.getOrNull(latestSelectedTabIndex) ?: tabsFlow.value.first()
}
}