Avoid division by zero in storage.

Bug: 26387833
Change-Id: I144475d4b82d91dcfd2271cd775e43d595914cef
This commit is contained in:
Jeff Sharkey
2016-02-18 15:43:54 -07:00
parent 42ed344f4b
commit d36e574cfa

View File

@@ -39,7 +39,11 @@ public class StorageItemPreference extends Preference {
public void setStorageSize(long size, long total) {
setSummary(Formatter.formatFileSize(getContext(), size));
progress = (int)(size * PROGRESS_MAX / total);
if (total == 0) {
progress = 0;
} else {
progress = (int)(size * PROGRESS_MAX / total);
}
updateProgressBar();
}