Skip to content

Commit 864d7e3

Browse files
committed
Ensure that FileSystemTree.Node.getChildAt is robust to ArrayIndexOutOfBoundsException.
1 parent ebbf33c commit 864d7e3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/org/scijava/ui/swing/script/FileSystemTree.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,12 @@ public synchronized int getChildCount() {
178178
@Override
179179
public synchronized Node getChildAt(final int index) {
180180
if (0 == getChildCount()) return null;
181-
return (Node) super.getChildAt(index);
181+
try {
182+
return (Node) super.getChildAt(index);
183+
} catch (ArrayIndexOutOfBoundsException ae) {
184+
System.out.println("FileSystemTree: no child at index " + index + " for file at " + this.path);
185+
return null;
186+
}
182187
}
183188

184189
public Icon getIcon() {

0 commit comments

Comments
 (0)