From c53cabb68760b1c34a4af847cd83117dcf76a755 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 1 Jun 2008 05:09:23 +0200 Subject: [PATCH] fix npe if nothing is selected --- src/net/pterodactylus/jsite/gui/FileManager.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/net/pterodactylus/jsite/gui/FileManager.java b/src/net/pterodactylus/jsite/gui/FileManager.java index 9a3a758..34b07a3 100644 --- a/src/net/pterodactylus/jsite/gui/FileManager.java +++ b/src/net/pterodactylus/jsite/gui/FileManager.java @@ -591,12 +591,14 @@ public class FileManager extends JDialog implements I18nable, ActionListener, Tr private List getSelectedProjectFileWrappers(boolean filesOnly) { List selectedProjectFileWrappers = new ArrayList(); TreePath[] selectedPaths = fileTree.getSelectionPaths(); - for (TreePath selectedPath : selectedPaths) { - ProjectFileWrapper projectFileWrapper = (ProjectFileWrapper) selectedPath.getLastPathComponent(); - if (filesOnly && !projectFileWrapper.getProjectFile().isFile()) { - continue; + if (selectedPaths != null) { + for (TreePath selectedPath : selectedPaths) { + ProjectFileWrapper projectFileWrapper = (ProjectFileWrapper) selectedPath.getLastPathComponent(); + if (filesOnly && !projectFileWrapper.getProjectFile().isFile()) { + continue; + } + selectedProjectFileWrappers.add(projectFileWrapper); } - selectedProjectFileWrappers.add(projectFileWrapper); } return selectedProjectFileWrappers; } -- 2.7.4