From 508676d9bdfdf2fabfd84cde360ef61b94117d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linnea=20Gr=C3=A4f?= Date: Mon, 22 Jul 2024 15:00:05 +0200 Subject: [PATCH] Fix resolving non existant files in the root directory --- src/main/java/dev/exhq/ajarc/vm/JsVm.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); }