From c8e1eddc3f662c0563a7064281e367db95fd2103 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 24 Mar 2015 16:55:22 +1030 Subject: [PATCH] Fix error if there is no included data with user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit i.e. if the logged in user is unconfirmed (doesn’t have any groups attached) --- framework/core/src/Web/Actions/IndexAction.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/framework/core/src/Web/Actions/IndexAction.php b/framework/core/src/Web/Actions/IndexAction.php index 7ca444b43..4628015d4 100644 --- a/framework/core/src/Web/Actions/IndexAction.php +++ b/framework/core/src/Web/Actions/IndexAction.php @@ -33,8 +33,12 @@ class IndexAction extends Action ]; $response = $this->callAction('Flarum\Api\Actions\Users\ShowAction', ['id' => $user->id]); + $response = $response->getData(); - $data = array_merge([$response->getData()->data], $response->getData()->included); + $data = [$response->data]; + if (isset($response->included)) { + $data = array_merge($data, $response->included); + } }