Skip to content

Commit 523b8a7

Browse files
authored
Merge pull request #34 from acardona/fix-sync-issue
Attempt at fixing the synchronization issue arising when saving a file into an open folder
2 parents d84db52 + 864d7e3 commit 523b8a7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,18 @@ public String toString() {
172172

173173
@Override
174174
public synchronized int getChildCount() {
175-
if (isRoot()) return super.getChildCount();
176-
return new File(this.path).isDirectory() ? updatedChildrenFiles(false).length : 0;
175+
return super.getChildCount();
177176
}
178177

179178
@Override
180179
public synchronized Node getChildAt(final int index) {
181180
if (0 == getChildCount()) return null;
182-
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+
}
183187
}
184188

185189
public Icon getIcon() {

0 commit comments

Comments
 (0)