Skip to content

Commit

Permalink
Add check for parser error (#390)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadayubi authored Apr 14, 2021
1 parent 2914fd0 commit dbfdb31
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mapml/layers/MapLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -698,9 +698,9 @@ export var MapMLLayer = L.Layer.extend({
}
function _processInitialExtent(content) {
var mapml = this.responseXML || content;
if(mapml.querySelector('feature'))layer._content = mapml;
if(mapml.querySelector && mapml.querySelector('feature'))layer._content = mapml;
if(!this.responseXML && this.responseText) mapml = new DOMParser().parseFromString(this.responseText,'text/xml');
if (this.readyState === this.DONE && mapml.querySelector) {
if (this.readyState === this.DONE && mapml.querySelector && !mapml.querySelector("parsererror")) {
var serverExtent = mapml.querySelector('extent') || mapml.querySelector('meta[name=projection]'), projection;

if (serverExtent.tagName.toLowerCase() === "extent" && serverExtent.hasAttribute('units')){
Expand Down

0 comments on commit dbfdb31

Please sign in to comment.