From d653e18ac5b42f171c0bc1a735227d48d96c50be Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Mon, 7 Aug 2023 21:19:52 +0100 Subject: [PATCH] handle case when no object is selected --- .../agents/imviewer/util/proj/ProjSavingDialog.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/openmicroscopy/shoola/agents/imviewer/util/proj/ProjSavingDialog.java b/src/main/java/org/openmicroscopy/shoola/agents/imviewer/util/proj/ProjSavingDialog.java index 3d7cbc128..e9c0d2e7a 100644 --- a/src/main/java/org/openmicroscopy/shoola/agents/imviewer/util/proj/ProjSavingDialog.java +++ b/src/main/java/org/openmicroscopy/shoola/agents/imviewer/util/proj/ProjSavingDialog.java @@ -201,10 +201,15 @@ private void setProperties() private void populateDatasetsBox(DataNode newDataset) { DataNode n = (DataNode) parentsBox.getSelectedItem(); - List list = n.getUIDatasetNodes(); + List list = null; + if (n != null) { + list = n.getUIDatasetNodes(); + } List l = new ArrayList(); if (newDataset != null) l.add(newDataset); - l.addAll(sorter.sort(list)); + if (list != null) { + l.addAll(sorter.sort(list)); + } datasetsBox.setVisible(l.size() > 0); datasetsBox.removeItemListener(datasetsBoxListener); datasetsBox.removeAllItems();