fix NPE in NomenclaturalStatusElement hotfix/5.9.1
authorKatja Luther <k.luther@bgbm.org>
Mon, 2 Sep 2019 08:05:32 +0000 (10:05 +0200)
committerKatja Luther <k.luther@bgbm.org>
Mon, 2 Sep 2019 09:10:41 +0000 (11:10 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NomenclaturalStatusElement.java

index f446793e403b6739f3830b3578e73cc4b4f2772e..0a980efc5e944870e27f0c73b9f1bd33f6752892 100644 (file)
@@ -56,6 +56,15 @@ public class NomenclaturalStatusElement extends AbstractReferencedEntityElement<
 
             @Override
             public int compare(NomenclaturalStatusType t1, NomenclaturalStatusType t2) {
+                if (t1 == t2){
+                    return 0;
+                }
+                if (t1 == null){
+                    return -1;
+                }
+                if (t2 == null){
+                    return 1;
+                }
                 if (t1.getIdInVocabulary() == t2.getIdInVocabulary()){
                     return 0;
                 }
@@ -66,6 +75,7 @@ public class NomenclaturalStatusElement extends AbstractReferencedEntityElement<
                     return t1.getIdInVocabulary().compareTo(t2.getLabel());
                 }
                 return t1.getIdInVocabulary().compareTo(t2.getIdInVocabulary());
+
             }
         };
 
@@ -83,6 +93,7 @@ public class NomenclaturalStatusElement extends AbstractReferencedEntityElement<
                super.setEntity(entity);
                if (entity.getType() != null){
                    nomenclaturalStatusTypeCombo.setSelection(entity.getType());
+                   nomenclaturalStatusTypeCombo.removeEmptyElement();
                }
                ruleConsideredText.setText(entity.getRuleConsidered());
        }