mirror of
https://github.com/flatpak/flatpak.git
synced 2026-03-16 22:19:47 -04:00
common: Fix division by zero when calculate progress
Closes: #1331 Approved by: alexlarsson
This commit is contained in:
@@ -6573,7 +6573,11 @@ progress_cb (OstreeAsyncProgress *progress, gpointer user_data)
|
||||
}
|
||||
|
||||
/* The download progress goes up to 97% */
|
||||
new_progress = 5 + ((total_transferred / (gdouble) total) * 92);
|
||||
if (total > 0) {
|
||||
new_progress = 5 + ((total_transferred / (gdouble) total) * 92);
|
||||
} else {
|
||||
new_progress = 97;
|
||||
}
|
||||
|
||||
/* And the writing of the objects adds 3% to the progress */
|
||||
new_progress += get_write_progress (outstanding_writes);
|
||||
|
||||
Reference in New Issue
Block a user