diff --git a/src/main/java/dev/exhq/ajarc/vm/JsVm.java b/src/main/java/dev/exhq/ajarc/vm/JsVm.java index 226db82..013190b 100644 --- a/src/main/java/dev/exhq/ajarc/vm/JsVm.java +++ b/src/main/java/dev/exhq/ajarc/vm/JsVm.java @@ -76,7 +76,6 @@ public class JsVm { for (int i = 0; i < splitPath.size(); i++) { var segment = splitPath.get(i); var child = node.listing().get(segment); - if (child == null) return null; if (child instanceof AjarSymlinkFile symlink) { // TODO: symlink infinite recursion protection if (symlink.target().startsWith("/")) { @@ -86,6 +85,7 @@ public class JsVm { } } if (i == splitPath.size() - 1) break; + if (child == null) return null; if (!(child instanceof AjarDirectory directory)) { throw new RuntimeException("No such file or directory " + path); }