summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2025-02-06 03:08:31 -0800
committer Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-02-07 02:21:35 -0800
commitfe158822179be410f91d8c63e7e9d70571b66916 (patch)
tree234e6e142aa572ee017fcc597622cc0cf0ef4559
parentb6714bc1835e99e49d1175bb639bd91ebebe334d (diff)
Fix the divide-by-zero in odrefresh.
Bug: 394431986 Change-Id: Iaeddd98070bfe8d92d815db004c03cc262f3df82 Test: Presubmit
-rw-r--r--odrefresh/odrefresh.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/odrefresh/odrefresh.cc b/odrefresh/odrefresh.cc
index bf3d62d0d0..fc782bc697 100644
--- a/odrefresh/odrefresh.cc
+++ b/odrefresh/odrefresh.cc
@@ -870,7 +870,8 @@ static void ReportNextBootAnimationProgress(uint32_t current_compilation,
uint32_t number_of_compilations) {
// We arbitrarily show progress until 90%, expecting that our compilations take a large chunk of
// boot time.
- uint32_t value = (90 * current_compilation) / number_of_compilations;
+ uint32_t value =
+ number_of_compilations != 0 ? (90 * current_compilation) / number_of_compilations : 90;
SetProperty("service.bootanim.progress", std::to_string(value));
}