Guard from NaN crashes in batch add

This commit is contained in:
Jobobby04 2023-03-16 17:30:28 -04:00
parent d94270ce32
commit 28f3c4f4c6

View File

@ -100,12 +100,18 @@ class BatchAddScreen : Screen() {
Modifier.fillMaxWidth(), Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {
LinearProgressIndicator( val progress = state.progress.toFloat()
progress = state.progress.toFloat() / state.progressTotal, if (state.progressTotal > 0 && !progress.isNaN()) {
Modifier val realProgress = progress / state.progressTotal
.padding(top = 2.dp) if (!realProgress.isNaN()) {
.weight(1f), LinearProgressIndicator(
) progress = realProgress,
Modifier
.padding(top = 2.dp)
.weight(1f),
)
}
}
Text( Text(
text = state.progress.toString() + "/" + state.progressTotal, text = state.progress.toString() + "/" + state.progressTotal,
modifier = Modifier.weight(0.15f), modifier = Modifier.weight(0.15f),