From d1ac37984e625924c574a1ac9645ac0baffc97e2 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Tue, 29 Aug 2006 11:19:00 +0000 Subject: [PATCH] Fix for #198, from Sean Gillies. Thanks, Sean! git-svn-id: http://svn.openlayers.org/trunk/openlayers@1392 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/GeoRSS.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Layer/GeoRSS.js b/lib/OpenLayers/Layer/GeoRSS.js index 49d44df71b..48cbf565b3 100644 --- a/lib/OpenLayers/Layer/GeoRSS.js +++ b/lib/OpenLayers/Layer/GeoRSS.js @@ -70,8 +70,22 @@ OpenLayers.Layer.GeoRSS.prototype = continue; } location = new OpenLayers.LonLat(parseFloat(location[1]), parseFloat(location[0])); - var title = OpenLayers.Util.getNodes(itemlist[i], "title")[0].firstChild.nodeValue; - var description = OpenLayers.Util.getNodes(itemlist[i], "description")[0].firstChild.nodeValue; + + /* Provide defaults for title and description */ + var title = "No title"; + try { + title = OpenLayers.Util.getNodes(itemlist[i], + "title")[0].firstChild.nodeValue; + } + catch (e) { alert(e); } + + var description = "No description"; + try { + description = OpenLayers.Util.getNodes(itemlist[i], + "description")[0].firstChild.nodeValue; + } + catch (e) { alert(e); } + try { var link = OpenLayers.Util.getNodes(itemlist[i], "link")[0].firstChild.nodeValue; } catch (e) { } data.icon = OpenLayers.Marker.defaultIcon(); data.popupSize = new OpenLayers.Size(250, 100);