Plugin Directory

Changeset 916620


Ignore:
Timestamp:
05/18/2014 03:32:16 PM (12 years ago)
Author:
dkukral
Message:

fixed bug with bad geocode result on settings page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • postmapper/trunk/postmapper.php

    r916617 r916620  
    471471        $data = json_decode($result);
    472472        $location = "Unknown";
    473         if (in_array('political', $data->{'results'}[0]->{'types'})) {
    474             $lat = $data->{'results'}[0]->{'geometry'}->{'location'}->{'lat'};
    475             $lng = $data->{'results'}[0]->{'geometry'}->{'location'}->{'lng'};
    476             $location = $lat . "," . $lng;
     473        if ($data->{'results'}) {
     474            if (in_array('political', $data->{'results'}[0]->{'types'})) {
     475                $lat = $data->{'results'}[0]->{'geometry'}->{'location'}->{'lat'};
     476                $lng = $data->{'results'}[0]->{'geometry'}->{'location'}->{'lng'};
     477                $location = $lat . "," . $lng;
     478            }
    477479        }
    478480        update_option('postmapper_default_city_geocode', $location);
Note: See TracChangeset for help on using the changeset viewer.