Guard from NaN crashes in batch add
This commit is contained in:
parent
d94270ce32
commit
28f3c4f4c6
@ -100,12 +100,18 @@ class BatchAddScreen : Screen() {
|
||||
Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
LinearProgressIndicator(
|
||||
progress = state.progress.toFloat() / state.progressTotal,
|
||||
Modifier
|
||||
.padding(top = 2.dp)
|
||||
.weight(1f),
|
||||
)
|
||||
val progress = state.progress.toFloat()
|
||||
if (state.progressTotal > 0 && !progress.isNaN()) {
|
||||
val realProgress = progress / state.progressTotal
|
||||
if (!realProgress.isNaN()) {
|
||||
LinearProgressIndicator(
|
||||
progress = realProgress,
|
||||
Modifier
|
||||
.padding(top = 2.dp)
|
||||
.weight(1f),
|
||||
)
|
||||
}
|
||||
}
|
||||
Text(
|
||||
text = state.progress.toString() + "/" + state.progressTotal,
|
||||
modifier = Modifier.weight(0.15f),
|
||||
|
Loading…
x
Reference in New Issue
Block a user