From: David ‘Bombe’ Roden Date: Thu, 22 Mar 2012 20:12:23 +0000 (+0100) Subject: Don’t throw a NullPointerException when no file is selected. X-Git-Tag: 0.10^2~11 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=8655761d78156e4d17f874ea0de5a40cc5a24246;p=jSite.git Don’t throw a NullPointerException when no file is selected. --- diff --git a/src/de/todesbaum/jsite/gui/ProjectFilesPage.java b/src/de/todesbaum/jsite/gui/ProjectFilesPage.java index 8bfc631..a6fa3ab 100644 --- a/src/de/todesbaum/jsite/gui/ProjectFilesPage.java +++ b/src/de/todesbaum/jsite/gui/ProjectFilesPage.java @@ -249,6 +249,11 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis @SuppressWarnings("synthetic-access") private void storeText(DocumentEvent documentEvent) { FileOption fileOption = getSelectedFile(); + if (fileOption == null) { + /* no file selected. */ + System.out.println("yfwdasd"); + return; + } Document document = documentEvent.getDocument(); int documentLength = document.getLength(); try {