From: Brian Quinion Date: Fri, 30 Aug 2013 13:21:01 +0000 (+0100) Subject: Fail clean for place lookups for null/invalid place_ids X-Git-Tag: v2.2.0~44 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/d6b70c9b731b396f6d3baa49d3740fc52f4c3ede Fail clean for place lookups for null/invalid place_ids --- diff --git a/lib/PlaceLookup.php b/lib/PlaceLookup.php index 07cf8062..3f1bdda8 100644 --- a/lib/PlaceLookup.php +++ b/lib/PlaceLookup.php @@ -37,6 +37,8 @@ function lookup() { + if (!$this->iPlaceID) return null; + $sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted", $this->aLangPrefOrder))."]"; $sSQL = "select placex.*,"; @@ -47,6 +49,8 @@ $sSQL .= " from placex where place_id = ".(int)$this->iPlaceID; $aPlace = $this->oDB->getRow($sSQL); + if (!$aPlace['place_id']) return null; + if ($this->bAddressDetails) { $aAddress = getAddressDetails($this->oDB, $sLanguagePrefArraySQL, $this->iPlaceID, $aPlace['calculated_country_code']);