trivial: Fix a potential division by zero

Spotted by Coverity.
This commit is contained in:
Richard Hughes 2021-09-24 18:27:57 +01:00
parent 4b09701452
commit f302bbcb03

View File

@ -564,6 +564,8 @@ fu_progress_get_step_percentage(FuProgress *self, guint idx)
current += step->value;
total += step->value;
}
if (total == 0)
return 0;
return ((gdouble)current * 100.f) / (gdouble)total;
}