Fail clean for place lookups for null/invalid place_ids

This commit is contained in:
Brian Quinion 2013-08-30 14:21:01 +01:00
parent 5f941407b3
commit d6b70c9b73

View File

@ -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']);