Преглед изворни кода

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 година
родитељ
комит
163db32a21
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];
 
     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;