From 20544ac1fc52660d72edf6c0761749d3c9136b2d Mon Sep 17 00:00:00 2001 From: Katja Luther Date: Fri, 3 May 2019 12:36:15 +0200 Subject: [PATCH] fix NPE --- .../taxeditor/preference/PreferencesUtil.java | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 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 d67f4d931..a312c5051 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 @@ -1535,46 +1535,46 @@ public class PreferencesUtil implements IPreferenceKeys { String value; value = getStringValue(PreferencePredicate.NameDetailsView.getKey(), false); + if (value != null){ + String [] sections = value.split(";"); + Map sectionMap = new HashMap(); + String[] sectionValues; + for (String sectionValue: sections){ + sectionValues = sectionValue.split(":"); + sectionMap.put(sectionValues[0], Boolean.valueOf(sectionValues[1])); + } - String [] sections = value.split(";"); - Map sectionMap = new HashMap(); - String[] sectionValues; - for (String sectionValue: sections){ - sectionValues = sectionValue.split(":"); - sectionMap.put(sectionValues[0], Boolean.valueOf(sectionValues[1])); - } - - config.setSimpleDetailsViewActivated(getValue(sectionMap, "simpleViewActivated")); - - config.setTaxonSectionActivated(getValue(sectionMap, "taxon")); + config.setSimpleDetailsViewActivated(getValue(sectionMap, "simpleViewActivated")); - config.setSecDetailsActivated(getValue(sectionMap, "taxon.SecDetails")); - config.setSecEnabled(getValue(sectionMap, "taxon.SecEnabled")); + config.setTaxonSectionActivated(getValue(sectionMap, "taxon")); - config.setLSIDActivated(getValue(sectionMap, "lsid")); + config.setSecDetailsActivated(getValue(sectionMap, "taxon.SecDetails")); + config.setSecEnabled(getValue(sectionMap, "taxon.SecEnabled")); - config.setNomenclaturalCodeActived(getValue(sectionMap, "nc")); + config.setLSIDActivated(getValue(sectionMap, "lsid")); - config.setAppendedPhraseActivated(getValue(sectionMap, "ap")); + config.setNomenclaturalCodeActived(getValue(sectionMap, "nc")); - config.setRankActivated(getValue(sectionMap, "rank")); + config.setAppendedPhraseActivated(getValue(sectionMap, "ap")); - config.setAtomisedEpithetsActivated(getValue(sectionMap, "atomisedEpithets")); + config.setRankActivated(getValue(sectionMap, "rank")); - config.setAuthorshipSectionActivated(getValue(sectionMap,"author")); + config.setAtomisedEpithetsActivated(getValue(sectionMap, "atomisedEpithets")); - config.setNomenclaturalReferenceSectionActivated(sectionMap.get("nomRef")); + config.setAuthorshipSectionActivated(getValue(sectionMap,"author")); - config.setNomenclaturalStatusSectionActivated(getValue(sectionMap, "nomStat")); + config.setNomenclaturalReferenceSectionActivated(sectionMap.get("nomRef")); - config.setProtologueActivated(getValue(sectionMap,"protologue")); + config.setNomenclaturalStatusSectionActivated(getValue(sectionMap, "nomStat")); - config.setTypeDesignationSectionActivated(getValue(sectionMap,"typeDes")); + config.setProtologueActivated(getValue(sectionMap,"protologue")); - config.setNameRelationsSectionActivated(getValue(sectionMap,"nameRelation")); + config.setTypeDesignationSectionActivated(getValue(sectionMap,"typeDes")); - config.setHybridActivated(getValue(sectionMap,"hybrid")); + config.setNameRelationsSectionActivated(getValue(sectionMap,"nameRelation")); + config.setHybridActivated(getValue(sectionMap,"hybrid")); + } return config; } -- 2.34.1