From 7911b7b2cbe42d804c82ba74000e4d464d28d6a5 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Sat, 7 Apr 2018 06:27:58 -0700 Subject: [PATCH] Fixed #2687 --- CHANGELOG-v3.md | 1 + src/controllers/EntriesController.php | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-v3.md b/CHANGELOG-v3.md index 4d102bc03f9..8278d5b9ae8 100644 --- a/CHANGELOG-v3.md +++ b/CHANGELOG-v3.md @@ -6,6 +6,7 @@ - Fixed an error that could occur in the Control Panel if any plugins with licensing issues were installed. ([#2691](https://github.com/craftcms/cms/pull/2691)) - Fixed a bug on the Plugin Store’s Payment screen where the “Use a new credit card” radio option would not get selected automatically even if it was the only one available. - Fixed a bug where `craft\web\assets\vue\VueAsset` didn’t respect the `useCompressedJs` config setting. +- Fixed an error that occurred when saving a Single entry over Ajax. ([#2687](https://github.com/craftcms/cms/issues/2687)) ## 3.0.1 - 2018-04-04 diff --git a/src/controllers/EntriesController.php b/src/controllers/EntriesController.php index 39204e11afb..e486ed9ad64 100644 --- a/src/controllers/EntriesController.php +++ b/src/controllers/EntriesController.php @@ -569,7 +569,10 @@ 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);