allow null value to rgbToHex method

This commit is contained in:
Claudio Barril 2015-03-08 00:54:34 -03:00
parent 36f2143f46
commit 53e210456e

View File

@ -357,6 +357,7 @@ public class FreemindExporter
private String rgbToHex(String color) { private String rgbToHex(String color) {
String result = color; String result = color;
if (color != null) {
boolean isRGB = Pattern.matches("^rgb\\([0-9]{1,3}, [0-9]{1,3}, [0-9]{1,3}\\)$", color); boolean isRGB = Pattern.matches("^rgb\\([0-9]{1,3}, [0-9]{1,3}, [0-9]{1,3}\\)$", color);
if (isRGB) { if (isRGB) {
String[] rgb = color.substring(4, color.length() - 1).split(","); String[] rgb = color.substring(4, color.length() - 1).split(",");
@ -365,6 +366,7 @@ public class FreemindExporter
Integer b = Integer.valueOf(rgb[2].trim()); Integer b = Integer.valueOf(rgb[2].trim());
result = String.format("#%02x%02x%02x", r, g, b); result = String.format("#%02x%02x%02x", r, g, b);
} }
}
return result; return result;
} }