Fix possible NPE
authorPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 15 Aug 2018 15:06:30 +0000 (17:06 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 15 Aug 2018 15:06:30 +0000 (17:06 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureNodeDropAdapter.java

index 69ec880749d4c132fd04c406f5f64c526c8bfa0d..1b98cd59c1300e6680671a5b0e29a9014677cf45 100644 (file)
@@ -60,14 +60,16 @@ public class FeatureNodeDropAdapter extends ViewerDropAdapter {
                if (target != null) {
                        int location = getCurrentLocation();
                        FeatureNode parent = target.getParent();
-                       if (location == LOCATION_BEFORE) {
-                               position = Math.max(0, parent.getIndex(target) - 1);
-                               target = parent;
-                       }
+                       if(parent!=null){
+                           if (location == LOCATION_BEFORE) {
+                               position = Math.max(0, parent.getIndex(target) - 1);
+                               target = parent;
+                           }
 
-                       if (location == LOCATION_AFTER) {
-                               position = parent.getIndex(target);
-                               target = parent;
+                           if (location == LOCATION_AFTER) {
+                               position = parent.getIndex(target);
+                               target = parent;
+                           }
                        }
                }