Added validation when $parent is null

This commit is contained in:
Fernando Ontiveros
2025-04-16 23:24:34 +00:00
parent 818395f1a3
commit 35869e115f

View File

@@ -605,7 +605,7 @@ class TemplatePower extends TemplatePowerParser
public function newBlock($blockname)
{
$parent = &$this->content[$this->parent[$blockname] . '_' . $this->index[$this->parent[$blockname]]];
$lastitem = sizeof($parent);
$lastitem = !is_null($parent) ? sizeof($parent) : 0;
$lastitem > 1 ? $lastitem-- : $lastitem = 0;
$ind_blockname = $blockname . '_' . $this->index[$blockname];
if (!isset($parent[$lastitem]["_B:$blockname"])) {