Guard from NaN crashes in batch add
(cherry picked from commit 28f3c4f4c696700ed516b3e7acc3299be1dc7d1d)
This commit is contained in:
parent
0f2462248e
commit
6ed4b79746
@ -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),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user