From 6937fabe3ac2685f5d9e46a53c2db9232d3d6b76 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Tue, 22 Jan 2008 00:17:29 +0000 Subject: [PATCH] Ensure that GeoRSS format does not fail when reprojection null geometries. patch=Edgemaster, ar=me (Closes #1258) git-svn-id: http://svn.openlayers.org/trunk/openlayers@5837 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Format/GeoRSS.js | 2 +- tests/Format/test_GeoRSS.html | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Format/GeoRSS.js b/lib/OpenLayers/Format/GeoRSS.js index 97fda1ab32..89c8e911b8 100644 --- a/lib/OpenLayers/Format/GeoRSS.js +++ b/lib/OpenLayers/Format/GeoRSS.js @@ -155,7 +155,7 @@ OpenLayers.Format.GeoRSS = OpenLayers.Class(OpenLayers.Format.XML, { geometry = feature.geometry; } - if (this.internalProjection && this.externalProjection) { + if (geometry && this.internalProjection && this.externalProjection) { geometry.transform(this.externalProjection, this.internalProjection); } diff --git a/tests/Format/test_GeoRSS.html b/tests/Format/test_GeoRSS.html index 0f9828a88a..02272bd48a 100644 --- a/tests/Format/test_GeoRSS.html +++ b/tests/Format/test_GeoRSS.html @@ -35,6 +35,13 @@ t.eq(data[0].geometry.x, -1, "w3c geo x read correctly"); t.eq(data[0].geometry.y, 1, "w3c geo y read correctly"); } + function test_Format_GeoRSS_reproject_null(t) { + t.plan(1); + + var parser = new OpenLayers.Format.GeoRSS({'internalProjection':new OpenLayers.Projection("EPSG:4326"), 'externalProjection': new OpenLayers.Projection("EPSG:4326")}); + var data = parser.read(''); + t.eq(data.length, 1, "Parsing items with null geometry and reprojection doesn't fail"); + } function test_Format_GeoRSS_roundtrip(t) { t.plan(input.length); var parser = new OpenLayers.Format.GeoRSS();