Merge "Avoid division by zero in storage." into nyc-dev
am: d1152d86cf
* commit 'd1152d86cff31fea37120c979e5f4e87ce43da0c':
Avoid division by zero in storage.
This commit is contained in:
@@ -39,7 +39,11 @@ public class StorageItemPreference extends Preference {
|
|||||||
|
|
||||||
public void setStorageSize(long size, long total) {
|
public void setStorageSize(long size, long total) {
|
||||||
setSummary(Formatter.formatFileSize(getContext(), size));
|
setSummary(Formatter.formatFileSize(getContext(), size));
|
||||||
progress = (int)(size * PROGRESS_MAX / total);
|
if (total == 0) {
|
||||||
|
progress = 0;
|
||||||
|
} else {
|
||||||
|
progress = (int)(size * PROGRESS_MAX / total);
|
||||||
|
}
|
||||||
updateProgressBar();
|
updateProgressBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user