*
* The MIT License (MIT)
*
- * Copyright (C) 2017 Kevin Lamonte
+ * Copyright (C) 2019 Kevin Lamonte
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
import java.util.LinkedList;
import jexer.TWidget;
-import jexer.ttree.TTreeViewWidget;
/**
* TDirectoryTreeItem is a single item in a disk directory tree view.
return;
}
- for (File f: file.listFiles()) {
- // System.err.printf(" -> file %s %s\n", file, file.getName());
+ File [] listFiles = file.listFiles();
+ if (listFiles != null) {
+ for (File f: listFiles) {
+ // System.err.printf(" -> file %s %s\n", file, file.getName());
- if (f.getName().startsWith(".")) {
- // Hide dot-files
- continue;
- }
- if (!f.isDirectory()) {
- continue;
- }
+ if (f.getName().startsWith(".")) {
+ // Hide dot-files
+ continue;
+ }
+ if (!f.isDirectory()) {
+ continue;
+ }
- try {
- TDirectoryTreeItem item = new TDirectoryTreeItem(treeViewWidget,
- f.getCanonicalPath(), false, false);
+ try {
+ TDirectoryTreeItem item = new TDirectoryTreeItem(treeViewWidget,
+ f.getCanonicalPath(), false, false);
- item.level = this.level + 1;
- getChildren().add(item);
- } catch (IOException e) {
- continue;
+ item.level = this.level + 1;
+ getChildren().add(item);
+ } catch (IOException e) {
+ continue;
+ }
}
}
Collections.sort(getChildren());