Skip to content

Commit

Permalink
Fixed trying to access null object when setting image to null
Browse files Browse the repository at this point in the history
  • Loading branch information
sweoggy committed Jun 28, 2018
1 parent 3655032 commit 1cf08d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Entity/BlockTranslation.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ public function getImage(): ?BlockImageInterface
*/
public function setImage(?BlockImageInterface $image): void
{
$image->setOwner($this);
if ($image !== null) {
$image->setOwner($this);
}

$this->image = $image;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Entity/PageTranslation.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ public function getImage(): ?PageImageInterface
*/
public function setImage(?PageImageInterface $image): void
{
$image->setOwner($this);
if ($image !== null) {
$image->setOwner($this);
}

$this->image = $image;
}
Expand Down

0 comments on commit 1cf08d4

Please sign in to comment.