From 1079c3759134ae70049253e8f64737beca65956f Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Thu, 23 Nov 2023 11:57:31 +0100 Subject: [PATCH] fix: prevent call to undefined text property --- src/Nodes/Heading.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Nodes/Heading.php b/src/Nodes/Heading.php index 01fd732..a2878cd 100644 --- a/src/Nodes/Heading.php +++ b/src/Nodes/Heading.php @@ -18,7 +18,10 @@ public function renderHTML($node, $HTMLAttributes = []) // Add slugified id to specific headlines. if (in_array($node->attrs->level, config('anchor-navigation.heading.levels', []))) { - $HTMLAttributes['id'] = Str::slug($node->content[0]->text); + + if (property_exists($node->content[0], 'text') && !is_null($node->content[0]->text)) { + $HTMLAttributes['id'] = Str::slug($node->content[0]->text); + } } return [