mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-08 02:54:08 +00:00
Fail clean for place lookups for null/invalid place_ids
This commit is contained in:
@@ -37,6 +37,8 @@
|
|||||||
|
|
||||||
function lookup()
|
function lookup()
|
||||||
{
|
{
|
||||||
|
if (!$this->iPlaceID) return null;
|
||||||
|
|
||||||
$sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted", $this->aLangPrefOrder))."]";
|
$sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted", $this->aLangPrefOrder))."]";
|
||||||
|
|
||||||
$sSQL = "select placex.*,";
|
$sSQL = "select placex.*,";
|
||||||
@@ -47,6 +49,8 @@
|
|||||||
$sSQL .= " from placex where place_id = ".(int)$this->iPlaceID;
|
$sSQL .= " from placex where place_id = ".(int)$this->iPlaceID;
|
||||||
$aPlace = $this->oDB->getRow($sSQL);
|
$aPlace = $this->oDB->getRow($sSQL);
|
||||||
|
|
||||||
|
if (!$aPlace['place_id']) return null;
|
||||||
|
|
||||||
if ($this->bAddressDetails)
|
if ($this->bAddressDetails)
|
||||||
{
|
{
|
||||||
$aAddress = getAddressDetails($this->oDB, $sLanguagePrefArraySQL, $this->iPlaceID, $aPlace['calculated_country_code']);
|
$aAddress = getAddressDetails($this->oDB, $sLanguagePrefArraySQL, $this->iPlaceID, $aPlace['calculated_country_code']);
|
||||||
|
|||||||
Reference in New Issue
Block a user