]> git.openstreetmap.org Git - nominatim.git/commitdiff
Fail clean for place lookups for null/invalid place_ids
authorBrian Quinion <brian.quinion@mapquest.com>
Fri, 30 Aug 2013 13:21:01 +0000 (14:21 +0100)
committerBrian Quinion <brian.quinion@mapquest.com>
Fri, 6 Sep 2013 08:47:46 +0000 (09:47 +0100)
lib/PlaceLookup.php

index 07cf8062a8f8d99bcfc0b86f7fda603ecdb94612..3f1bdda8d8c5a670cc1e8a6b88acf360b9aaab0c 100644 (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']);