diff options
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/AlertType.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm index c3d4a3672..32654e534 100644 --- a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm +++ b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm @@ -235,12 +235,14 @@ sub _get_address_from_gecode { my $h = new IO::String($geocode); my $data = RABX::wire_rd($h); + my $str = ''; + my $address = $data->{resourceSets}[0]{resources}[0]{address}; my @address; - push @address, $address->{addressLine} if $address->{addressLine} ne 'Street'; - push @address, $address->{locality}; - my $str .= sprintf(_("Nearest road to the pin placed on the map (automatically generated by Bing Maps): %s\n\n"), - join( ', ', @address ) ); + push @address, $address->{addressLine} if $address->{addressLine} && $address->{addressLine} ne 'Street'; + push @address, $address->{locality} if $address->{locality}; + $str .= sprintf(_("Nearest road to the pin placed on the map (automatically generated by Bing Maps): %s\n\n"), + join( ', ', @address ) ) if @address; return $str; } |