From 69b5a779e4398b5b80aec7fd4225177f65540d31 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Thu, 27 Jun 2019 18:08:12 +0300 Subject: [PATCH] Fixed error when calling `Media::add($name, null)` --- CHANGELOG.md | 1 + system/src/Grav/Common/Page/Medium/AbstractMedia.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 809f7c762..f21442757 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Added support for custom `FormFlash` save locations 1. [](#bugfix) * Fixed some potential issues when `$grav['user']` is not set + * Fixed error when calling `Media::add($name, null)` # v1.6.11 ## 06/21/2019 diff --git a/system/src/Grav/Common/Page/Medium/AbstractMedia.php b/system/src/Grav/Common/Page/Medium/AbstractMedia.php index 0ad4573d8..f67cd650e 100644 --- a/system/src/Grav/Common/Page/Medium/AbstractMedia.php +++ b/system/src/Grav/Common/Page/Medium/AbstractMedia.php @@ -154,6 +154,9 @@ abstract class AbstractMedia implements ExportInterface, MediaCollectionInterfac */ public function add($name, $file) { + if (!$file) { + return; + } $this->offsetSet($name, $file); switch ($file->type) { case 'image':