summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkitfox2011-02-15 13:49:48 +0100
committerkitfox2011-02-15 13:49:48 +0100
commit2e041c76b74dfeb66c20f1b937a9a562b0311222 (patch)
treec736041e77df8dfbefe425ff8452b122ab9f1bb4
parentAdded support for the SVG Marker tag. (diff)
downloadsvg-salamander-core-2e041c76b74dfeb66c20f1b937a9a562b0311222.tar.gz
svg-salamander-core-2e041c76b74dfeb66c20f1b937a9a562b0311222.tar.xz
svg-salamander-core-2e041c76b74dfeb66c20f1b937a9a562b0311222.zip
Fixed NPE exception when parsing styles of 0 length.
git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@89 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b
-rw-r--r--src/main/java/com/kitfox/svg/xml/XMLParseUtil.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/com/kitfox/svg/xml/XMLParseUtil.java b/src/main/java/com/kitfox/svg/xml/XMLParseUtil.java
index 3cf1a78..0d0121b 100644
--- a/src/main/java/com/kitfox/svg/xml/XMLParseUtil.java
+++ b/src/main/java/com/kitfox/svg/xml/XMLParseUtil.java
@@ -782,7 +782,7 @@ public class XMLParseUtil
}
/**
- * Takes a CSS style string and retursn a hash of them.
+ * Takes a CSS style string and returns a hash of them.
* @param styleString - A CSS formatted string of styles. Eg,
* "font-size:12;fill:#d32c27;fill-rule:evenodd;stroke-width:1pt;"
* @param map - A map to which these styles will be added
@@ -796,7 +796,13 @@ public class XMLParseUtil
String[] styles = patSemi.split(styleString);
- for (int i = 0; i < styles.length; i++) {
+ for (int i = 0; i < styles.length; i++)
+ {
+ if (styles[i].length() == 0)
+ {
+ continue;
+ }
+
String[] vals = patColonSpace.split(styles[i]);
matcherContent.reset(vals[0]);