Skip to content

Commit

Permalink
Check if image exists
Browse files Browse the repository at this point in the history
  • Loading branch information
rmens committed Oct 21, 2024
1 parent f580690 commit 9f7ea9f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/teksttv.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,16 @@ private function get_primary_category_image($post_id)

private function get_image_slide($block)
{
return [
'type' => 'image',
'duration' => \intval($block['seconden']) * 1000,
'url' => $block['afbeelding']['url'],
];
// Check if the image exists
if (!empty($block['afbeelding']) && !empty($block['afbeelding']['url'])) {
return [
'type' => 'image',
'duration' => \intval($block['seconden']) * 1000,
'url' => $block['afbeelding']['url'],
];
}
// If no image exists, return null or an empty array, depending on your needs
return null;
}

private function get_ad_campaigns()
Expand Down

0 comments on commit 9f7ea9f

Please sign in to comment.