Fix error if there is no included data with user

i.e. if the logged in user is unconfirmed (doesn’t have any groups
attached)
This commit is contained in:
Toby Zerner 2015-03-24 16:55:22 +10:30
parent 47262c2970
commit 193bb0b085

View File

@ -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);
}
}