Skip to content

Commit

Permalink
Better check for sane hash
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed May 2, 2024
1 parent 99ac9bb commit 1a2d947
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Geo/Coder/List.pm
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,10 @@ sub geocode {
print 'Number of matches from ', ref($geocoder), ': ', scalar(@rc), "\n" if($self->{'debug'});
print Data::Dumper->new([\@rc])->Dump() if($self->{'debug'} >= 2);
if(defined($rc[0])) { # check it's not an empty hash
if((!defined($rc[0]->{lat})) || (!defined($rc[0]->{lng}))) {
::diag(Data::Dumper->new([\@rc])->Dump());
Carp::croak("BUG: '$location': HASH exists but is not sensible");
}
if(wantarray) {
$self->_cache($location, \@rc);
return @rc;
Expand Down

0 comments on commit 1a2d947

Please sign in to comment.