diff --git a/lib/template/details-html.php b/lib/template/details-html.php
index eca76c7e..9124d594 100644
--- a/lib/template/details-html.php
+++ b/lib/template/details-html.php
@@ -74,10 +74,12 @@ body {
var proj_map = map.getProjectionObject();
var latlon;
var linearRing = new OpenLayers.Geometry.LinearRing(pointList).transform(proj_EPSG4326, proj_map);;
var polygonFeature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([linearRing]),null,style);
diff --git a/lib/template/search-xml.php b/lib/template/search-xml.php
index b15c9a2e..6e48be4c 100644
--- a/lib/template/search-xml.php
+++ b/lib/template/search-xml.php
@@ -42,7 +42,7 @@
echo ','.$aResult['aBoundingBox'][3];
echo '"';
- if ($bShowPolygons)
+ if ($bShowPolygons && isset($aResult['aPolyPoints']))
{
echo ' polygonpoints=\'';
echo javascript_renderData($aResult['aPolyPoints']);
diff --git a/website/search.php b/website/search.php
index 4a75c768..7169c829 100755
--- a/website/search.php
+++ b/website/search.php
@@ -1161,7 +1161,7 @@
}
// Output data suitable for display (points and a bounding box)
- if ($bShowPolygons)
+ if ($bShowPolygons && isset($aPolyPoints))
{
$aResult['aPolyPoints'] = array();
foreach($aPolyPoints as $aPoint)