Skip to content

Commit

Permalink
Fixed #2764
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Apr 18, 2018
1 parent 05b6d07 commit 5332468
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixed
- Fixed an error that occurred when editing an entry if any of the entry’s revisions were created with an entry type that no longer exists.
- Fixed an error that could occur when saving an asset. ([#2764](https://github.com/craftcms/cms/issues/2764))

## 3.0.3 - 2018-04-17

Expand Down
7 changes: 5 additions & 2 deletions src/elements/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -1212,9 +1212,12 @@ public function afterSave(bool $isNew)
{
// If this is just an element being propagated, there's absolutely no need for re-saving this.
if (!$this->propagating) {
if (AssetsHelper::getFileKindByExtension($this->tempFilePath) === static::KIND_IMAGE &&
if (
$this->tempFilePath !== null &&
AssetsHelper::getFileKindByExtension($this->tempFilePath) === static::KIND_IMAGE &&
\in_array($this->getScenario(), [self::SCENARIO_REPLACE, self::SCENARIO_CREATE], true) &&
null !== $this->tempFilePath) {
null !== $this->tempFilePath
) {
Image::cleanImageByPath($this->tempFilePath);
}

Expand Down

0 comments on commit 5332468

Please sign in to comment.