From 4625a011237bb51e68214af81aea9f688df2e1b8 Mon Sep 17 00:00:00 2001 From: Katja Luther Date: Thu, 15 Sep 2016 13:18:42 +0200 Subject: [PATCH] ref #5969: check if there is a NC preference in db if not use the local NC preference --- .../taxeditor/preference/PreferencesUtil.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java index d6a8f6bf7..00bbfff96 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java @@ -116,9 +116,13 @@ public class PreferencesUtil implements IPreferenceKeys { CdmPreference preference = null; if (preferredCode == null){ preference = controller.getPreferenceService().find(key); - int index = StringUtils.lastIndexOf(preference.getValue(), "."); - UUID uuid = UUID.fromString(preference.getValue().substring(index +1, preference.getValue().length())); - preferredCode = NomenclaturalCode.getByUuid(uuid); + if (preference == null){ + return; + } else{ + int index = StringUtils.lastIndexOf(preference.getValue(), "."); + UUID uuid = UUID.fromString(preference.getValue().substring(index +1, preference.getValue().length())); + preferredCode = NomenclaturalCode.getByUuid(uuid); + } } else{ preference = CdmPreference.NewInstance(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.NomenclaturalCode, preferredCode.getKey()); controller.getPreferenceService().set(preference); -- 2.34.1