summaryrefslogtreecommitdiff
path: root/gnu/javax/swing/text/html/css/CSSColor.java
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/javax/swing/text/html/css/CSSColor.java')
-rw-r--r--gnu/javax/swing/text/html/css/CSSColor.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/gnu/javax/swing/text/html/css/CSSColor.java b/gnu/javax/swing/text/html/css/CSSColor.java
index 57230f12a..ea4b94ae0 100644
--- a/gnu/javax/swing/text/html/css/CSSColor.java
+++ b/gnu/javax/swing/text/html/css/CSSColor.java
@@ -110,9 +110,16 @@ public class CSSColor
val1 = (String) COLOR_MAP.get(val1);
if (val1 != null)
{
- String hexVal = val1.substring(1);
- int rgb = Integer.parseInt(hexVal, 16);
- color = new Color(rgb);
+ String hexVal = val1.substring(1).trim();
+ try
+ {
+ int rgb = Integer.parseInt(hexVal, 16);
+ color = new Color(rgb);
+ }
+ catch (NumberFormatException ex)
+ {
+ color = Color.BLACK;
+ }
}
else
color = null;