From 1cf08d4dcd5e7e82a07f5c40a6c0190a954be332 Mon Sep 17 00:00:00 2001 From: Oscar Reimer Date: Thu, 28 Jun 2018 16:09:46 +0200 Subject: [PATCH] Fixed trying to access null object when setting image to null --- src/Entity/BlockTranslation.php | 4 +++- src/Entity/PageTranslation.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Entity/BlockTranslation.php b/src/Entity/BlockTranslation.php index ed74e7a6c..3a0900924 100755 --- a/src/Entity/BlockTranslation.php +++ b/src/Entity/BlockTranslation.php @@ -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; } diff --git a/src/Entity/PageTranslation.php b/src/Entity/PageTranslation.php index 5c8964687..995bbc3a9 100755 --- a/src/Entity/PageTranslation.php +++ b/src/Entity/PageTranslation.php @@ -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; }