Jelajahi Sumber

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 tahun lalu
induk
melakukan
163db32a21
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  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;