Skip to content

Commit 46c32a2

Browse files
fix: crash current must not be NaN during bulk download (#63) (#412)
- Add validation to ensure that the progress value is not NaN. fixes: LEARNER-10248 Co-authored-by: Farhan Arshad <[email protected]>
1 parent 4566b1a commit 46c32a2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

course/src/main/java/org/openedx/course/presentation/ui/CourseVideosUI.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,12 @@ private fun AllVideosDownloadItem(
543543
)
544544
}
545545
if (isDownloadingAllVideos) {
546-
val progress = 1 - downloadModelsSize.remainingSize.toFloat() / downloadModelsSize.allSize
546+
val progress =
547+
if (downloadModelsSize.allSize == 0L) {
548+
0f
549+
} else {
550+
1 - downloadModelsSize.remainingSize.toFloat() / downloadModelsSize.allSize
551+
}
547552

548553
val animatedProgress by animateFloatAsState(
549554
targetValue = progress,

0 commit comments

Comments
 (0)