[FIX] HashedDir NPE

This commit is contained in:
Gravita 2021-09-22 11:02:23 +07:00
parent 7ab7c29fe4
commit 77b5188b52

View file

@ -68,6 +68,7 @@ public void remove(String name) {
map.remove(name); map.remove(name);
} }
@Deprecated
public void removeR(String name) { public void removeR(String name) {
LinkedList<String> dirs = new LinkedList<>(); LinkedList<String> dirs = new LinkedList<>();
StringTokenizer t = new StringTokenizer(name, "/"); StringTokenizer t = new StringTokenizer(name, "/");
@ -117,6 +118,9 @@ public FindRecursiveResult findRecursive(String path) {
if (e == null && !t.hasMoreTokens()) { if (e == null && !t.hasMoreTokens()) {
break; break;
} }
if (e == null) {
throw new RuntimeException(String.format("Directory %s not found", name));
}
if (e.getType() == Type.DIR) { if (e.getType() == Type.DIR) {
if (!t.hasMoreTokens()) { if (!t.hasMoreTokens()) {
entry = e; entry = e;