Fixed "Cannot read property 'firstElementChild' of null" on WFS readProjectionFromNode.
Occurs when a FeatureCollection is empty. Code style changes @bartvde Added test case for #3118. Attempt to make jshint happy. Fixed tab character. Another code style change (jshint)....
This commit is contained in:
@@ -747,8 +747,10 @@ ol.format.WFS.prototype.readProjectionFromDocument = function(doc) {
|
||||
ol.format.WFS.prototype.readProjectionFromNode = function(node) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
|
||||
goog.asserts.assert(node.localName == 'FeatureCollection');
|
||||
node = node.firstElementChild.firstElementChild;
|
||||
if (goog.isDefAndNotNull(node)) {
|
||||
|
||||
if (goog.isDefAndNotNull(node.firstElementChild) &&
|
||||
goog.isDefAndNotNull(node.firstElementChild.firstElementChild)) {
|
||||
node = node.firstElementChild.firstElementChild;
|
||||
for (var n = node.firstElementChild; !goog.isNull(n);
|
||||
n = n.nextElementSibling) {
|
||||
if (!(n.childNodes.length === 0 ||
|
||||
@@ -760,5 +762,6 @@ ol.format.WFS.prototype.readProjectionFromNode = function(node) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user