From 193bb0b08532869bc3be738b58c91d7f2c6ba2b8 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) --- src/Web/Actions/IndexAction.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Web/Actions/IndexAction.php b/src/Web/Actions/IndexAction.php index 7ca444b43..4628015d4 100644 --- a/src/Web/Actions/IndexAction.php +++ b/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); + } }