mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-13 23:00:45 -04:00
Fix: handle null library artifact
This commit is contained in:
parent
3ba8fe0388
commit
5c4f214a1d
@ -384,6 +384,15 @@ public final class Tools {
|
|||||||
return strList.toArray(new String[0]);
|
return strList.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String artifactToPath(DependentLibrary library) {
|
||||||
|
if (library.downloads != null &&
|
||||||
|
library.downloads.artifact != null &&
|
||||||
|
library.downloads.artifact.path != null)
|
||||||
|
return library.downloads.artifact.path;
|
||||||
|
String[] libInfos = library.name.split(":");
|
||||||
|
return libInfos[0].replaceAll("\\.", "/") + "/" + libInfos[1] + "/" + libInfos[2] + "/" + libInfos[1] + "-" + libInfos[2] + ".jar";
|
||||||
|
}
|
||||||
|
|
||||||
public static String getPatchedFile(String version) {
|
public static String getPatchedFile(String version) {
|
||||||
return DIR_HOME_VERSION + "/" + version + "/" + version + ".jar";
|
return DIR_HOME_VERSION + "/" + version + "/" + version + ".jar";
|
||||||
}
|
}
|
||||||
@ -606,7 +615,7 @@ public final class Tools {
|
|||||||
List<String> libDir = new ArrayList<>();
|
List<String> libDir = new ArrayList<>();
|
||||||
for (DependentLibrary libItem: info.libraries) {
|
for (DependentLibrary libItem: info.libraries) {
|
||||||
if(!checkRules(libItem.rules)) continue;
|
if(!checkRules(libItem.rules)) continue;
|
||||||
libDir.add(Tools.DIR_HOME_LIBRARY + "/" + libItem.downloads.artifact.path);
|
libDir.add(Tools.DIR_HOME_LIBRARY + "/" + artifactToPath(libItem));
|
||||||
}
|
}
|
||||||
return libDir.toArray(new String[0]);
|
return libDir.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ public class AsyncMinecraftDownloader {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String libArtifact = libItem.downloads.artifact.path;
|
String libArtifact = Tools.artifactToPath(libItem);
|
||||||
outLib = new File(Tools.DIR_HOME_LIBRARY + "/" + libArtifact);
|
outLib = new File(Tools.DIR_HOME_LIBRARY + "/" + libArtifact);
|
||||||
outLib.getParentFile().mkdirs();
|
outLib.getParentFile().mkdirs();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user