From 2271b916534d1efb947259139722c0b6f077828c Mon Sep 17 00:00:00 2001 From: Gravit Date: Sat, 12 Sep 2020 15:57:03 +0700 Subject: [PATCH] =?UTF-8?q?[FIX][EXPERIMENTAL]=20=D0=9D=D0=B5=D0=BA=D0=BE?= =?UTF-8?q?=D1=80=D1=80=D0=B5=D0=BA=D1=82=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D0=B0=20findRecursive=20=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=20=D0=BE=D1=82=D1=81=D1=83=D1=82=D1=81=D1=82=D0=B2=D0=B8=D0=B8?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=BD=D0=B5=D1=87=D0=BD=D0=BE=D0=B3=D0=BE=20Has?= =?UTF-8?q?hedEntry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../profiles/optional/actions/OptionalActionFile.java | 3 +++ .../src/main/java/pro/gravit/launcher/hasher/HashedDir.java | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/actions/OptionalActionFile.java b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/actions/OptionalActionFile.java index 4b9d5e53..7551c82b 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/actions/OptionalActionFile.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/actions/OptionalActionFile.java @@ -1,6 +1,7 @@ package pro.gravit.launcher.profiles.optional.actions; import pro.gravit.launcher.hasher.HashedDir; +import pro.gravit.utils.helper.LogHelper; import java.util.List; import java.util.Map; @@ -13,7 +14,9 @@ public void injectToHashedDir(HashedDir dir) files.forEach((k,v) -> { HashedDir.FindRecursiveResult firstPath = dir.findRecursive(k); if (v != null && !v.isEmpty()) { + LogHelper.dev("Debug findRecursive: name %s, parent: ", firstPath.name, firstPath.parent == null ? "null" : "not null", firstPath.entry == null ? "null" : "not null"); HashedDir.FindRecursiveResult secondPath = dir.findRecursive(v); + LogHelper.dev("Debug findRecursive: name %s, parent: ", secondPath.name, secondPath.parent == null ? "null" : "not null", secondPath.entry == null ? "null" : "not null"); firstPath.parent.moveTo(firstPath.name, secondPath.parent, secondPath.name); } }); diff --git a/LauncherCore/src/main/java/pro/gravit/launcher/hasher/HashedDir.java b/LauncherCore/src/main/java/pro/gravit/launcher/hasher/HashedDir.java index cfdda33d..319b10a2 100644 --- a/LauncherCore/src/main/java/pro/gravit/launcher/hasher/HashedDir.java +++ b/LauncherCore/src/main/java/pro/gravit/launcher/hasher/HashedDir.java @@ -126,6 +126,10 @@ public FindRecursiveResult findRecursive(String path) while (t.hasMoreTokens()) { name = t.nextToken(); HashedEntry e = current.map.get(name); + if(e == null && !t.hasMoreTokens()) + { + break; + } if (e.getType() == Type.DIR) { if(!t.hasMoreTokens()) { entry = e;