From 53e210456efb9f00c69c9f69c1871ff5c4c7f15e Mon Sep 17 00:00:00 2001 From: Claudio Barril Date: Sun, 8 Mar 2015 00:54:34 -0300 Subject: [PATCH] allow null value to rgbToHex method --- .../wisemapping/exporter/FreemindExporter.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java b/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java index 403421af..39474edf 100755 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java @@ -357,13 +357,15 @@ public class FreemindExporter private String rgbToHex(String color) { String result = color; - boolean isRGB = Pattern.matches("^rgb\\([0-9]{1,3}, [0-9]{1,3}, [0-9]{1,3}\\)$", color); - if (isRGB) { - String[] rgb = color.substring(4, color.length() - 1).split(","); - Integer r = Integer.valueOf(rgb[0].trim()); - Integer g = Integer.valueOf(rgb[1].trim()); - Integer b = Integer.valueOf(rgb[2].trim()); - result = String.format("#%02x%02x%02x", r, g, b); + if (color != null) { + boolean isRGB = Pattern.matches("^rgb\\([0-9]{1,3}, [0-9]{1,3}, [0-9]{1,3}\\)$", color); + if (isRGB) { + String[] rgb = color.substring(4, color.length() - 1).split(","); + Integer r = Integer.valueOf(rgb[0].trim()); + Integer g = Integer.valueOf(rgb[1].trim()); + Integer b = Integer.valueOf(rgb[2].trim()); + result = String.format("#%02x%02x%02x", r, g, b); + } } return result; }