From d6b70c9b731b396f6d3baa49d3740fc52f4c3ede Mon Sep 17 00:00:00 2001 From: Brian Quinion Date: Fri, 30 Aug 2013 14:21:01 +0100 Subject: [PATCH] Fail clean for place lookups for null/invalid place_ids --- lib/PlaceLookup.php | 4 ++++ 1 file changed, 4 insertions(+) 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']);