From: David ‘Bombe’ Roden Date: Sun, 1 Jun 2008 03:09:23 +0000 (+0200) Subject: fix npe if nothing is selected X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=c53cabb68760b1c34a4af847cd83117dcf76a755;p=jSite2.git fix npe if nothing is selected --- 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; }