fix #5971 fix NPE for not existing preference
authorAndreas Müller <a.mueller@bgbm.org>
Thu, 1 Dec 2016 15:02:15 +0000 (16:02 +0100)
committerAndreas Müller <a.mueller@bgbm.org>
Thu, 1 Dec 2016 15:02:15 +0000 (16:02 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NomenclaturalCodePreferences.java

index 212cb992dbcc65f3b5ac0768aba663ee019c1dcb..451645ae84ec6e01594188122b02b93a330c1ed1 100644 (file)
@@ -34,18 +34,10 @@ import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
  *
  * @author p.ciardelli
  * @created 16.09.2008
- * @version 1.0
  */
 public class NomenclaturalCodePreferences extends FieldEditorPreferencePage
                implements IWorkbenchPreferencePage {
 
-       /*
-        * (non-Javadoc)
-        *
-        * @see
-        * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
-        * ()
-        */
        @Override
        protected void createFieldEditors() {
            PreferencesUtil.setPreferredNomenclaturalCode(null, false);
@@ -97,7 +89,7 @@ public class NomenclaturalCodePreferences extends FieldEditorPreferencePage
               IPreferenceService service = controller.getPreferenceService();
               PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.NomenclaturalCode);
               CdmPreference pref = service.find(key);
-              getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY, pref.isAllowOverride());
+              getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY, pref == null? true : pref.isAllowOverride());
           }
 
            if (getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY)) {
@@ -125,6 +117,4 @@ public class NomenclaturalCodePreferences extends FieldEditorPreferencePage
         return result;
     }
 
-
-
 }