From: Eduardo Date: Sun, 10 Dec 2023 13:55:37 +0000 (+0100) Subject: prevent var being null X-Git-Url: http://git.edufdez.es/?a=commitdiff_plain;h=afba30f37a25fb85cbc0da1b5906c0aa1f3d009b;p=thericegoat.com.git prevent var being null --- diff --git a/page-generator/generator.php b/page-generator/generator.php index 191ed06..03c583e 100644 --- a/page-generator/generator.php +++ b/page-generator/generator.php @@ -198,7 +198,7 @@ class CodeGenerator $html = ""; // if previous iteration was diferent section or is first iteration and new section is not empty add h2 - if (($currentIndex != 0 && $data[$currentIndex - 1]['section'] != $section) || ($currentIndex == 0 && !empty($section))) { + if (($currentIndex != 0 && $this->str_val_or_empty($data[$currentIndex - 1], 'section') != $section) || ($currentIndex == 0 && !empty($section))) { $html .= 'filter_meta_classes($class); @@ -478,7 +478,7 @@ class CodeGenerator switch ($class) { case in_array("list", $class): // if previous iteration was diferent section close li - if ($i != 0 && $data[$i - 1]['section'] != $section) { + if ($i != 0 && $this->str_val_or_empty($data[$i - 1], 'section') != $section) { [$closing_tag, $is_list_closed] = $this->open_or_close_ul($is_list_closed, $class, CLOSE, $text); $html .= $closing_tag; } @@ -503,7 +503,7 @@ class CodeGenerator default: // if previous iteration was diferent section close p - if ($i != 0 && $data[$i - 1]['section'] != $section) { + if ($i != 0 && $this->str_val_or_empty($data[$i - 1], 'section') != $section) { [$closing_tag, $is_p_closed] = $this->open_or_close_p($is_p_closed, $class, CLOSE); $html .= $closing_tag;