Skip to content

Commit

Permalink
Updated ipstack service to ensure that apiresults exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Witwicki authored and Michael Witwicki committed Dec 16, 2021
1 parent 5bc0be3 commit ba01cef
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/services/IpstackService.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,14 @@ public function get()
// The api only returns a success key if that key is set to false...which is fun.
// So we look for that key and then we look to make sure it is false
// and then we set the data to an empty string
if (array_key_exists('success', $api_result) && !$api_result['success']) {
$data = [];
if ($api_result !== null) {
if (array_key_exists('success', $api_result) && !$api_result['success']) {
$data = [];
} else {
$data = $api_result;
}
} else {
$data = $api_result;
$data = [];
}
}

Expand Down

0 comments on commit ba01cef

Please sign in to comment.