Skip to content

Commit

Permalink
Update BitlyClient.php
Browse files Browse the repository at this point in the history
Check if RequestException has a response before checking the statuscode.
  • Loading branch information
Shivella authored Apr 3, 2021
1 parent cb3e0d1 commit 943cdae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Client/BitlyClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function getUrl(string $url): string

$response = $this->client->send($request);
} catch (RequestException $e) {
if ($e->getResponse()->getStatusCode() === Response::HTTP_FORBIDDEN) {
if ($e->getResponse() !== null && $e->getResponse()->getStatusCode() === Response::HTTP_FORBIDDEN) {
throw new AccessDeniedException('Invalid access token.', $e->getCode(), $e);
}

Expand Down

0 comments on commit 943cdae

Please sign in to comment.