Check if filename is set before deleting

This commit is contained in:
Jannis Portmann 2021-06-15 18:18:43 +02:00
parent 2e4e005a55
commit 5680522395

View file

@ -145,7 +145,10 @@ class OfferController extends AbstractController
if ($offer->getByUser() === $user)
{
unlink($photoDir . '/' . $offer->getPhotoFilename());
if ($offer->getPhotoFilename())
{
unlink($photoDir . '/' . $offer->getPhotoFilename());
}
$this->entityManager->remove($offer);
$this->entityManager->flush();
$this->addFlash(