From 1a2d947ae972ddb4a2566431a3ced3f80d87a6c6 Mon Sep 17 00:00:00 2001 From: Nigel Horne Date: Thu, 2 May 2024 13:35:32 -0400 Subject: [PATCH] Better check for sane hash --- lib/Geo/Coder/List.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Geo/Coder/List.pm b/lib/Geo/Coder/List.pm index f0325c7..b52724b 100644 --- a/lib/Geo/Coder/List.pm +++ b/lib/Geo/Coder/List.pm @@ -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;