ref #9762: avoid NPE
authorKatja Luther <k.luther@bgbm.org>
Tue, 21 Sep 2021 09:13:29 +0000 (11:13 +0200)
committerKatja Luther <k.luther@bgbm.org>
Tue, 21 Sep 2021 09:15:37 +0000 (11:15 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/term/TermComboElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java

index 23b9d73deaf3537859c9ca1bac8f1eb772c3c1fd..09ae05ce5b5c1315d8879720d70e85c7bb85eaa0 100755 (executable)
@@ -420,7 +420,7 @@ public class TermComboElement<T extends DefinedTermBase>
         * @param terms a {@link List} of T objects or <code>null</code> for default preferred terms
         */
        public void setTerms(List<T> terms) {
-               setSelection(null);
+//             setSelection(null);
                customPreferredTerms = terms;
                populateTerms(customPreferredTerms);
        }
index 08b46d4d46e550d3f1b8670bdd15c699436534b7..f3c8c75ca8ce5d91c6988daa80cc24cf3ecfc432 100644 (file)
@@ -86,6 +86,9 @@ public class NameDetailElement
                        comparator = new Comparator<Rank>(){
                                @Override
                                public int compare(Rank o1, Rank o2) {
+                                   if (o2 == null){
+                                       return -1;
+                                   }
                                        return o1.compareTo(o2);
                                }
                        };
@@ -178,7 +181,7 @@ public class NameDetailElement
                        switch(code){
                        case ICNAFP :
                                //nothing do add
-                           if (nonViralName.getRank().isCultivar()){
+                           if (nonViralName.getRank() != null && nonViralName.getRank().isCultivar()){
                                createCultivarNameParts(formElement, nonViralName, style);
                            }else{
                                createBotanicalNameParts(formElement, nonViralName, style);