Fix OPML import crashing when entry doesnt't have a name

This commit is contained in:
Shinokuni 2024-08-18 18:00:24 +02:00
parent c54a14e616
commit 96e3bca4a2
4 changed files with 10 additions and 10 deletions

View File

@ -134,7 +134,7 @@ class AccountScreenModel(
openDialog( openDialog(
DialogState.OPMLImport( DialogState.OPMLImport(
currentFeed = foldersAndFeeds.values.first().first().name!!, currentFeed = foldersAndFeeds.values.first().first().name,
feedCount = 0, feedCount = 0,
feedMax = foldersAndFeeds.values.flatten().size feedMax = foldersAndFeeds.values.flatten().size
) )
@ -148,7 +148,7 @@ class AccountScreenModel(
it.copy( it.copy(
dialog = dialog.copy( dialog = dialog.copy(
currentFeed = feed.name!!, currentFeed = feed.name,
feedCount = dialog.feedCount + 1 feedCount = dialog.feedCount + 1
) )
) )
@ -225,7 +225,7 @@ data class AccountState(
sealed interface DialogState { sealed interface DialogState {
data object DeleteAccount : DialogState data object DeleteAccount : DialogState
data object NewAccount : DialogState data object NewAccount : DialogState
data class OPMLImport(val currentFeed: String, val feedCount: Int, val feedMax: Int) : data class OPMLImport(val currentFeed: String?, val feedCount: Int, val feedMax: Int) :
DialogState DialogState
data class ErrorList(val errorResult: ErrorResult) : DialogState data class ErrorList(val errorResult: ErrorResult) : DialogState

View File

@ -4,12 +4,12 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import com.readrops.app.R import com.readrops.app.R
import com.readrops.app.util.components.dialog.BaseDialog
import com.readrops.app.util.components.RefreshIndicator import com.readrops.app.util.components.RefreshIndicator
import com.readrops.app.util.components.dialog.BaseDialog
@Composable @Composable
fun OPMLImportProgressDialog( fun OPMLImportProgressDialog(
currentFeed: String, currentFeed: String?,
feedCount: Int, feedCount: Int,
feedMax: Int, feedMax: Int,
) { ) {

View File

@ -84,7 +84,7 @@ class AccountSelectionScreenModel(
mutableState.update { mutableState.update {
it.copy( it.copy(
showOPMLImportDialog = true, showOPMLImportDialog = true,
currentFeed = foldersAndFeeds.values.first().first().name!!, currentFeed = foldersAndFeeds.values.first().first().name,
feedCount = 0, feedCount = 0,
feedMax = foldersAndFeeds.values.flatten().size feedMax = foldersAndFeeds.values.flatten().size
) )
@ -98,7 +98,7 @@ class AccountSelectionScreenModel(
onUpdate = { feed -> onUpdate = { feed ->
mutableState.update { mutableState.update {
it.copy( it.copy(
currentFeed = feed.name!!, currentFeed = feed.name,
feedCount = it.feedCount + 1 feedCount = it.feedCount + 1
) )
} }
@ -121,7 +121,7 @@ data class AccountSelectionState(
val showOPMLImportDialog: Boolean = false, val showOPMLImportDialog: Boolean = false,
val navState: NavState = NavState.Idle, val navState: NavState = NavState.Idle,
val exception: Exception? = null, val exception: Exception? = null,
val currentFeed: String = "", val currentFeed: String? = null,
val feedCount: Int = 0, val feedCount: Int = 0,
val feedMax: Int = 0 val feedMax: Int = 0
) )

View File

@ -29,7 +29,7 @@ fun RefreshScreen(
@Composable @Composable
fun RefreshIndicator( fun RefreshIndicator(
currentFeed: String, currentFeed: String?,
feedCount: Int, feedCount: Int,
feedMax: Int feedMax: Int
) { ) {
@ -44,7 +44,7 @@ fun RefreshIndicator(
VeryShortSpacer() VeryShortSpacer()
Text( Text(
text = "$currentFeed ($feedCount/$feedMax)", text = "${currentFeed.orEmpty()} ($feedCount/$feedMax)",
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
) )