Skip to content

Commit

Permalink
Merge pull request #530 from Iam444/hotfix/INT-2578
Browse files Browse the repository at this point in the history
Added strict comparison to 'null' to avoid TypeError from usage method_exist() function on 'null'
  • Loading branch information
bessudnov authored Sep 18, 2023
2 parents 2c8eeac + 20d1fd5 commit 2fbd2e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/AmoCRM/EntitiesServices/BaseEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ protected function createCollection(array $response): ?BaseApiCollection

$collection = !empty($entities) ? $collection::fromArray($entities) : null;

if (method_exists($collection, 'setNextPageLink') && isset($response['_links']['next']['href'])) {
if ($collection !== null && method_exists($collection, 'setNextPageLink') && isset($response['_links']['next']['href'])) {
$collection->setNextPageLink($response['_links']['next']['href']);
}

if (method_exists($collection, 'setPrevPageLink') && isset($response['_links']['prev']['href'])) {
if ($collection !== null && method_exists($collection, 'setPrevPageLink') && isset($response['_links']['prev']['href'])) {
$collection->setPrevPageLink($response['_links']['prev']['href']);
}

Expand Down

0 comments on commit 2fbd2e3

Please sign in to comment.