Fix to "style with no rule returns empty array" via the 'unruly.patch' from

tschaub. -10 points for bad pun, +10 points for catching this in his review
of the SLD code. r=me (Closes #1223)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@5536 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-12-20 13:01:19 +00:00
parent 3268e53ed1
commit 59dd8b2d99

View File

@@ -172,14 +172,14 @@ OpenLayers.Format.SLD = OpenLayers.Class(OpenLayers.Format.XML, {
var ruleNodes = this.getElementsByTagNameNS(
xmlNode, this.sldns, "Rule"
);
// I don't think you really want to return [] here
if (ruleNodes.length == 0) { return []; }
var rules = userStyle.rules;
var ruleName;
for (var i=0; i<ruleNodes.length; i++) {
ruleName = this.parseProperty(ruleNodes[i], this.sldns, "Name");
rules.push(this.parseRule(ruleNodes[i], ruleName));
if (ruleNodes.length > 0) {
var rules = userStyle.rules;
var ruleName;
for (var i=0; i<ruleNodes.length; i++) {
ruleName = this.parseProperty(ruleNodes[i], this.sldns, "Name");
rules.push(this.parseRule(ruleNodes[i], ruleName));
}
}
return userStyle;