diff --git a/lib/OpenLayers/Format/SLD.js b/lib/OpenLayers/Format/SLD.js
index <HASH>..<HASH> 100644
--- a/lib/OpenLayers/Format/SLD.js
+++ b/lib/OpenLayers/Format/SLD.js
@@ -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;
Fix to "style with no rule returns empty array" via the 'unruly.patch' from
tschaub. -<I> points for bad pun, <I> points for catching this in his review
of the SLD code. r=me (Closes #<I>)


git-svn-id: <URL>