make sure no NPE when opening the lipid annotation dialog
@@ -21,9 +21,7 @@ package io.github.mzmine.modules.dataprocessing.id_lipididentification.lipids;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
-
import org.controlsfx.control.CheckTreeView;
-
import javafx.geometry.Orientation;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBoxTreeItem;
@@ -57,8 +55,9 @@ public class LipidClassComponent extends BorderPane {
// Don't show the root item
lipidChoices.setShowRoot(false);
- lipidChoices.setMinWidth(500);
+ lipidChoices.setMinWidth(600);
lipidChoices.setMinHeight(200);
+
// Load all lipid classes
LipidCategories coreClass = null;
LipidMainClasses mainClass = null;
@@ -74,7 +73,7 @@ public class LipidClassComponent extends BorderPane {
rootItem.getChildren().add(coreClassItem);
}
- if (lipidClass.getMainClass() != mainClass) {
+ if (lipidClass.getMainClass() != mainClass && coreClassItem != null) {
mainClassItem = new CheckBoxTreeItem<>(lipidClass.getMainClass());
mainClassItem.setExpanded(true);
mainClass = lipidClass.getMainClass();
@@ -83,7 +82,9 @@ public class LipidClassComponent extends BorderPane {
classItem = new CheckBoxTreeItem<>(lipidClass);
classToItemMap.put(lipidClass, classItem);
+ if (mainClassItem != null) {
mainClassItem.getChildren().add(classItem);
+ }
}
