Skip to content

Commit

Permalink
Merge pull request #163 from sweoggy/fixed-nulling-images
Browse files Browse the repository at this point in the history
Fixed trying to access null object when setting image to null
  • Loading branch information
bitbager authored Jul 3, 2018
2 parents 3655032 + 1cf08d4 commit cf353c8
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 cf353c8

Please sign in to comment.