From 5f941407b356fade1cec9671ea04853f7cfdc837 Mon Sep 17 00:00:00 2001 From: Brian Quinion Date: Fri, 30 Aug 2013 13:13:21 +0100 Subject: [PATCH] Allow for reverse geocode returning no results --- lib/Geocode.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Geocode.php b/lib/Geocode.php index 7eab3678..e5f3a157 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -218,6 +218,8 @@ function getDetails($aPlaceIDs, $iMinAddressRank = 0, $iMaxAddressRank = 30, $aAddressRankList = false, $sAllowedTypesSQLList = false, $bDeDupe = false) { + if (sizeof($aPlaceIDs) == 0) return array(); + $sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$this->aLangPrefOrder))."]"; // Get the details for display (is this a redundant extra step?) @@ -391,7 +393,7 @@ } $aSearchResults = array(); - if ($sQuery || $aStructuredQuery) + if ($sQuery || $this->aStructuredQuery) { // Start with a blank search $aSearches = array( @@ -1341,7 +1343,10 @@ { // Just interpret as a reverse geocode $iPlaceID = geocodeReverse((float)$this->aNearPoint[0], (float)$this->aNearPoint[1]); - $aSearchResults = $this->getDetails(array($iPlaceID)); + if ($iPlaceID) + $aSearchResults = $this->getDetails(array($iPlaceID)); + else + $aSearchResults = array(); } // No results? Done -- 2.39.5