Guard against divide by zero exceptions during progress events.
This commit is contained in:
parent
096b9c20d1
commit
77ee4296a5
@ -508,7 +508,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
String repoAddress = event.getData().getString(RepoUpdater.PROGRESS_DATA_REPO_ADDRESS);
|
||||
String downloadedSize = Utils.getFriendlySize(event.progress);
|
||||
String totalSize = Utils.getFriendlySize(event.total);
|
||||
int percent = (int) ((double) event.progress / event.total * 100);
|
||||
int percent = event.total > 0 ? (int) ((double) event.progress / event.total * 100) : -1;
|
||||
switch (event.type) {
|
||||
case RepoUpdater.PROGRESS_TYPE_PROCESS_XML:
|
||||
message = getString(R.string.status_processing_xml_percent, repoAddress, downloadedSize, totalSize, percent);
|
||||
|
Loading…
x
Reference in New Issue
Block a user