fix NPE when no preference for terms available
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / store / TermManager.java
index 6cb341ad5e0141beffdb1b353b116c65c629e0ba..64ca0927bdeed66eb0ab1195ad52904297ff3997 100644 (file)
@@ -195,15 +195,18 @@ public class TermManager {
        }
        
        public <T extends DefinedTermBase>List<T> createTermListFromString(String stringValue, TermType type){
-               String[] listChecked = stringValue.split(";"); //$NON-NLS-1$
-        String[] listCheckedComma = stringValue.split(","); //$NON-NLS-1$
-        List<String> checked = new ArrayList<>();
-        if (listChecked != null ){
-            checked = Arrays.asList(listChecked);
-        }
-        if (listCheckedComma != null && stringValue.contains(",")){ //$NON-NLS-1$
-            checked = Arrays.asList(listCheckedComma);
-        }
+                List<String> checked = new ArrayList<>();
+       
+               if (stringValue != null){
+                       String[] listChecked = stringValue.split(";"); //$NON-NLS-1$
+                       String[] listCheckedComma = stringValue.split(","); //$NON-NLS-1$
+                       if (listChecked != null ){
+                               checked = Arrays.asList(listChecked);
+                       }
+                       if (listCheckedComma != null && stringValue.contains(",")){ //$NON-NLS-1$
+                               checked = Arrays.asList(listCheckedComma);
+                       }
+               }
         List<T> termsFromStringValues = getTermsFromStringValues(checked, type);
         return termsFromStringValues;
        }