Skip to content

Commit f350235

Browse files
committed
Handle invalid folder locations in callback
This prevents a NullPointerException being thrown when the inputFolder parameter is undefined or invalid during callback
1 parent 1713385 commit f350235

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/main/java/org/scijava/batch/FileScriptBatchProcessor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ private List<File> populateFileList(File folder, FilenameFilter filter, boolean
105105
* Count all applicable files and display them in the dialog message
106106
*/
107107
protected void directoryCallback() {
108+
if (inputFolder == null || !inputFolder.exists()) return;
109+
108110
// get list of all applicable files
109111
FilenameFilter inputFilter;
110112
try {

src/main/java/org/scijava/batch/MenuScriptBatchProcessor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ private List<File> populateFileList(File folder, FilenameFilter filter,
8585
* Count all applicable files and display them in the dialog message
8686
*/
8787
protected void directoryCallback() {
88+
if (inputFolder == null || !inputFolder.exists()) return;
89+
8890
// get list of all applicable files
8991
FilenameFilter inputFilter;
9092
try {

0 commit comments

Comments
 (0)