On the homepage, I have code that is pulling from a subpage of a subpage. When the URL of that sub-subpage is changed, it then causes the homepage to throw a null error because the homepage can no longer find the associated page object. The code currently looks like this:
<figure class="main-carousel" id="<?= $page->uid() ?>"> <?php $projects = $center->hpfeatured()->toStructure(); foreach ($projects as $project): ?> <?php $selectproject = $project->hpoption()->toPage() ?> <?php if($selectproject->featured()->isNotEmpty()): ?> <?php $episode = $selectproject->featured()->toPage() ?> <div class="carousel-item" id="<?= $selectproject->uid() ?>"> <?php snippet('post-type', ['page' => $episode])?></div> <?php endif ?> <?php endforeach ?> </figure>
How would I make it so that if the object is NULL, it just shows up empty as opposed to throwing a NULL error?