From edf924438239afe45b66f95ebc29561104531ee7 Mon Sep 17 00:00:00 2001 From: Thayol Date: Tue, 6 Jul 2021 04:23:06 +0200 Subject: [PATCH] Fix crash from empty category --- index.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index c4391f7..a5054b4 100644 --- a/index.php +++ b/index.php @@ -510,7 +510,10 @@ function todo_list(array $model = []) : string foreach ($categories as $category_key => $category) { - ksort($categories[$category_key]["list"]); + if (!empty($categories[$category_key]["list"])) + { + ksort($categories[$category_key]["list"]); + } } $category_autofills = array_unique($category_autofills); @@ -531,6 +534,11 @@ function todo_list(array $model = []) : string $titles = array(); foreach ($categories as $category_key => $category) { + if (empty($category["list"])) + { + continue; + } + $te->set_block("MAIN_CATEGORY_ITEMS", ""); foreach ($category["list"] as $date_key => $date)