fix PHP error: count(): Argument #1 ($value) must be of type Countable|array, null given

This commit is contained in:
ralf 2025-01-30 09:29:17 +01:00
parent bea41b1898
commit 5aab2c5441

View File

@ -253,7 +253,7 @@ class Template extends Etemplate\Widget
} }
//error_log("$this running $method_name() cname: {$this->id} -> expand_name: $expand_name"); //error_log("$this running $method_name() cname: {$this->id} -> expand_name: $expand_name");
// Expand if it's different, or it hasn't been expanded yet (no children, and the template actually has children) // Expand if it's different, or it hasn't been expanded yet (no children, and the template actually has children)
if($expand_name && ($expand_name != $this->id || count($this->children) == 0 && count(static::$cache[$expand_name]->children) > 0)) if($expand_name && ($expand_name != $this->id || count($this->children ?? []) == 0 && count(static::$cache[$expand_name]->children ?? []) > 0))
{ {
if (($row_template = self::instance($expand_name))) if (($row_template = self::instance($expand_name)))
{ {