OpenLayers OpenLayers

Changeset 5536

Show
Ignore:
Timestamp:
12/20/07 08:01:19 (1 year ago)
Author:
crschmidt
Message:

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)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Format/SLD.js

    r5520 r5536  
    173173            xmlNode, this.sldns, "Rule" 
    174174        ); 
    175         // I don't think you really want to return [] here 
    176         if (ruleNodes.length == 0) { return []; } 
    177  
    178         var rules = userStyle.rules
    179         var ruleName; 
    180         for (var i=0; i<ruleNodes.length; i++) { 
    181             ruleName = this.parseProperty(ruleNodes[i], this.sldns, "Name"); 
    182             rules.push(this.parseRule(ruleNodes[i], ruleName)); 
     175 
     176        if (ruleNodes.length > 0) { 
     177            var rules = userStyle.rules; 
     178            var ruleName
     179            for (var i=0; i<ruleNodes.length; i++) { 
     180                ruleName = this.parseProperty(ruleNodes[i], this.sldns, "Name"); 
     181                rules.push(this.parseRule(ruleNodes[i], ruleName)); 
     182            } 
    183183        } 
    184184