Skip to content

Commit

Permalink
Merge pull request #4 from vreemt/fix/missing-encounter-index
Browse files Browse the repository at this point in the history
Add: check `location_area_encounters` index exists
  • Loading branch information
lmerotta authored Jun 21, 2019
2 parents 1b5336e + 4cef294 commit 5f6cc49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ public function sendRequest(string $className, $identifier)
$data = $callback($url);

// TODO: Remove this ugly hack once PokéAPI is fixed
if ($uri === Pokemon::POKEAPI_ENDPOINT) {
if ($uri === Pokemon::POKEAPI_ENDPOINT && isset($data['location_area_encounters'])) {
$data['location_area_encounters'] = $this->fixEncounters($data['location_area_encounters']);
}

Expand Down Expand Up @@ -702,4 +702,4 @@ private function getDefaultCallback(): callable
return json_decode($data, true);
};
}
}
}

0 comments on commit 5f6cc49

Please sign in to comment.