Просмотр исходного кода

countdown timer: Fix divide-by-zero crash when setting time to 00:00:00

    `expected_count` is set to be a minimum of 1 to avoid dividing by zero
    at the bottom of the affected function.
    The progress bar at the top now renders as empty when the time is set
    to zero.
woob 1 год назад
Родитель
Сommit
fce19e3ef6
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      views/countdown_view.c

+ 1 - 1
views/countdown_view.c

@@ -93,7 +93,7 @@ static void countdown_timer_view_on_draw(Canvas* canvas, void* ctx) {
     char buffer[64];
     char buffer[64];
 
 
     int32_t count = model->count;
     int32_t count = model->count;
-    int32_t expected_count = model->saved_count_setting;
+    int32_t expected_count = MAX(model->saved_count_setting, 1);
 
 
     CountDownViewSelect select = model->select;
     CountDownViewSelect select = model->select;