From 16e2093c74b2f456305926d06855ccf8bd69d44c Mon Sep 17 00:00:00 2001 From: Nuradiyana Date: Tue, 7 Mar 2023 17:04:52 +0700 Subject: [PATCH] Fixing null $body --- src/Client.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Client.php b/src/Client.php index 37fcb99..333c076 100644 --- a/src/Client.php +++ b/src/Client.php @@ -86,9 +86,11 @@ private function getAccessToken(): void /** @var array $body */ $body = \json_decode((string) $response->getBody(), true); - Assert::keyExists($body, 'access_token'); + if(\is_array($body)) { + Assert::keyExists($body, 'access_token'); - $this->accessToken = $body['access_token']; + $this->accessToken = $body['access_token']; + } } }