diff --git a/CHANGELOG-v2.md b/CHANGELOG-v2.md index 260f5391bc2..2a07cd72f92 100644 --- a/CHANGELOG-v2.md +++ b/CHANGELOG-v2.md @@ -1,5 +1,10 @@ # Release Notes for Craft CMS 2.x +## Unreleased + +### Fixed +- Fixed an error that occurred when saving a Single entry over Ajax. ([#2687](https://github.com/craftcms/cms/issues/2687)) + ## 2.6.3015 - 2018-04-06 ### Changed diff --git a/src/controllers/EntriesController.php b/src/controllers/EntriesController.php index 71b83893dd9..ec3e8338099 100644 --- a/src/controllers/EntriesController.php +++ b/src/controllers/EntriesController.php @@ -472,7 +472,11 @@ public function actionSaveEntry() $return['cpEditUrl'] = $entry->getCpEditUrl(); } - $return['authorUsername'] = $entry->getAuthor()->username; + if (($author = $entry->getAuthor()) !== null) + { + $return['authorUsername'] = $author->username; + } + $return['dateCreated'] = DateTimeHelper::toIso8601($entry->dateCreated); $return['dateUpdated'] = DateTimeHelper::toIso8601($entry->dateUpdated); $return['postDate'] = ($entry->postDate ? DateTimeHelper::toIso8601($entry->postDate) : null);