Browse code

Fix teaser is null issue

Benjamin Roth authored on22/03/2023 10:43:52
Showing2 changed files
... ...
@@ -86,7 +86,7 @@ class SendNewsNotificationJob
86 86
                                 $arrRow = array(
87 87
                                     'date' => date('d.m.Y',$item['date']),
88 88
                                     'headline' => $item['headline'],
89
-                                    'teaser' => StringUtil::substr(strip_tags(str_ireplace(array('<br />','<br>','<br/>','</p>','<p>'),' ',$item['teaser'])),128)
89
+                                    'teaser' => $item['teaser'] ? StringUtil::substr(strip_tags(str_ireplace(array('<br />','<br>','<br/>','</p>','<p>'),' ',$item['teaser'])),128) : ''
90 90
                                 );
91 91
 
92 92
                                 if (($objJumpTo = $Archive->getRelated('jumpTo')) !== null)
... ...
@@ -48,7 +48,7 @@ class NewsSendTestmailListener
48 48
                 $arrRow = array(
49 49
                     'date' => date('d.m.Y',$News->date),
50 50
                     'headline' => $News->headline,
51
-                    'teaser' => \Contao\StringUtil::substr(strip_tags(str_ireplace(array('<br />','<br>','<br/>','</p>','<p>'),' ',$News->teaser)),128)
51
+                    'teaser' => $News->teaser ? StringUtil::substr(strip_tags(str_ireplace(array('<br />','<br>','<br/>','</p>','<p>'),' ',$News->teaser)),128) : ''
52 52
                 );
53 53
 
54 54
                 if (($objJumpTo = $Archive->getRelated('jumpTo')) !== null)