diff --git a/lib/OpenLayers/Layer/WMS.js b/lib/OpenLayers/Layer/WMS.js index 833e7b0b24..27891979a4 100644 --- a/lib/OpenLayers/Layer/WMS.js +++ b/lib/OpenLayers/Layer/WMS.js @@ -177,7 +177,8 @@ OpenLayers.Layer.WMS = OpenLayers.Class(OpenLayers.Layer.Grid, { reverseAxisOrder: function() { var projCode = this.projection.getCode(); return parseFloat(this.params.VERSION) >= 1.3 && - !!(this.yx[projCode] || OpenLayers.Projection.defaults[projCode].yx); + !!(this.yx[projCode] || (OpenLayers.Projection.defaults[projCode] && + OpenLayers.Projection.defaults[projCode].yx)); }, /** diff --git a/tests/Layer/WMS.html b/tests/Layer/WMS.html index cdc00705a3..a6fe9746d5 100644 --- a/tests/Layer/WMS.html +++ b/tests/Layer/WMS.html @@ -423,6 +423,26 @@ t.ok( layer.grid == null, "grid set to null"); } + function test_customProjection(t) { + t.plan(1); + var map = new OpenLayers.Map('map', { + units: 'm', + projection: new OpenLayers.Projection('EPSG:28992'), + maxExtent: new OpenLayers.Bounds(0, 300000, 300000, 6250000) + }); + var layer = new OpenLayers.Layer.WMS(null, url, {layers: 'mylayer', version: '1.3.0'}); + map.addLayer(layer); + var error = false; + try { + map.setCenter(new OpenLayers.LonLat(100000,300000), 5); + } catch(err) { + error = true; + } + t.ok(!error, "no error on getURL if layer has a custom projection and no defaults defined"); + layer.destroy(); + map.destroy(); + } + function test_Layer_WMS_v13(t) { t.plan(6);