From 314a04d3626bb2faaa5d3d4f0191d305a71d8ede Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Wed, 27 Apr 2022 13:50:39 -0700 Subject: restore correct workflow when no census match is found: offer map-based picker, RT#86245, RT#76968 --- FS/FS/Misc/Geo.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'FS/FS') diff --git a/FS/FS/Misc/Geo.pm b/FS/FS/Misc/Geo.pm index 3beffc8..6f923f5 100644 --- a/FS/FS/Misc/Geo.pm +++ b/FS/FS/Misc/Geo.pm @@ -166,9 +166,11 @@ sub get_censustract_uscensus { warn Dumper($content) if $DEBUG; - if ( $content->{result}->{addressMatches} ) { + my $addressMatches_ref = $content->{result}->{addressMatches}; - my $tract = $content->{result}->{addressMatches}[0]->{geographies}->{'Census Blocks'}[0]->{GEOID}; + if ( $addressMatches_ref && scalar @{$addressMatches_ref} ) { + + my $tract = $addressMatches_ref->[0]->{geographies}->{'Census Blocks'}[0]->{GEOID}; return $tract; } else { -- cgit v1.1