fix #10169: checkedElements should not contain null values
authorKatja Luther <k.luther@bgbm.org>
Fri, 7 Oct 2022 09:48:51 +0000 (11:48 +0200)
committerKatja Luther <k.luther@bgbm.org>
Fri, 7 Oct 2022 09:50:12 +0000 (11:50 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/CheckBoxTreeComposite.java

index 72f77e24436e7dd71a74c17bba740456aa415b43..5b78e41860973bcc0f575bfa5f044bc246fe2eec 100644 (file)
@@ -103,15 +103,17 @@ public class CheckBoxTreeComposite extends Composite implements SelectionListene
                         checkedElements = tempArray;
                     }
                 }else{
-                    int index = 0;
+                    
                     if (checkedElements != null){
+                       Object[] tempArray = new Object[checkedElements.length -1];
+                       int index = 0;
                         for (Object o:checkedElements){
-                            if (o != null && o.equals(item.getData())){
-                                break;
+                            if (o != null && !o.equals(item.getData())){
+                               tempArray[index] = o;
+                               index++;
                             }
-                            index ++;
                         }
-                        checkedElements[index] = null;
+                        checkedElements = tempArray;
                     }
                 }