Skip to content

Commit

Permalink
Check if fallbacks is an array and more than 0 exist
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebauman committed Apr 30, 2015
1 parent c11ed46 commit c599a3d
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,19 @@ private function getLocationFromFallback()
{
$fallbacks = $this->getDriverFallbackList();

foreach($fallbacks as $fallbackDriver) {
$driver = $this->getDriver($fallbackDriver);
if(is_array($fallbacks) && count($fallbacks) > 0)
{
foreach($fallbacks as $fallbackDriver) {
$driver = $this->getDriver($fallbackDriver);

$location = $driver->get($this->ip);
$location = $driver->get($this->ip);

/*
* If no error has occurred, return the new location
*/
if(! $location->error) {
return $location;
/*
* If no error has occurred, return the new location
*/
if(! $location->error) {
return $location;
}
}
}

Expand Down

0 comments on commit c599a3d

Please sign in to comment.