Skip to content

Commit

Permalink
Merge pull request #3 from visuellverstehen/fix-call-to-member-functi…
Browse files Browse the repository at this point in the history
…on-field-on-null-error

fix: check if fieldtype is not null on fieldvalue
  • Loading branch information
simonerd authored Jun 12, 2024
2 parents 5f0c9cd + e732dd9 commit 06641dc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,13 @@ protected function renderContent(): string
return '';
}

if (! $this->fieldValue) {
$this->fieldValue = $this->entry->augmentedValue($this->fieldHandle);
// make sure we definitely have field data
// (might be a problem with e. g. old content files)
if (! $this->fieldValue && ! $this->fieldValue = $this->entry->augmentedValue($this->fieldHandle)) {
return '';
}

$fieldtype = $this->fieldValue->field()->fieldtype();
$fieldtype = $this->fieldValue->field()?->fieldtype();

if ($fieldtype instanceof Bard) {
return $this->renderBard($fieldtype);
Expand Down

0 comments on commit 06641dc

Please sign in to comment.