Fix crash from empty category

This commit is contained in:
2021-07-06 04:23:06 +02:00
parent 4f596d0d07
commit edf9244382
+8
View File
@@ -509,9 +509,12 @@ function todo_list(array $model = []) : string
$te->set_block("DATALIST_AUTOFILLS", ""); $te->set_block("DATALIST_AUTOFILLS", "");
foreach ($categories as $category_key => $category) foreach ($categories as $category_key => $category)
{
if (!empty($categories[$category_key]["list"]))
{ {
ksort($categories[$category_key]["list"]); ksort($categories[$category_key]["list"]);
} }
}
$category_autofills = array_unique($category_autofills); $category_autofills = array_unique($category_autofills);
foreach ($category_autofills as $autofill) foreach ($category_autofills as $autofill)
@@ -531,6 +534,11 @@ function todo_list(array $model = []) : string
$titles = array(); $titles = array();
foreach ($categories as $category_key => $category) foreach ($categories as $category_key => $category)
{ {
if (empty($category["list"]))
{
continue;
}
$te->set_block("MAIN_CATEGORY_ITEMS", ""); $te->set_block("MAIN_CATEGORY_ITEMS", "");
foreach ($category["list"] as $date_key => $date) foreach ($category["list"] as $date_key => $date)