Fixed NullPointerException when a version not exists.
This commit is contained in:
@@ -56,7 +56,8 @@ public class MinecraftAssetService extends IMinecraftAssetService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Task downloadAssets(final MinecraftVersion mv) {
|
public Task downloadAssets(final MinecraftVersion mv) {
|
||||||
Utils.requireNonNull(mv);
|
if (mv == null)
|
||||||
|
return null;
|
||||||
return new TaskInfo("Download Assets") {
|
return new TaskInfo("Download Assets") {
|
||||||
Collection<Task> afters = new HashSet<>();
|
Collection<Task> afters = new HashSet<>();
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class MinecraftDownloadService extends IMinecraftDownloadService {
|
|||||||
return downloadLibraries;
|
return downloadLibraries;
|
||||||
MinecraftVersion v = mv.resolve(service.version());
|
MinecraftVersion v = mv.resolve(service.version());
|
||||||
for (IMinecraftLibrary l : v.getLibraries())
|
for (IMinecraftLibrary l : v.getLibraries())
|
||||||
if (l != null && l.allow()) {
|
if (l != null && l.allow() && l.getDownloadInfo() != null) {
|
||||||
File ff = l.getFilePath(service.baseDirectory());
|
File ff = l.getFilePath(service.baseDirectory());
|
||||||
if (!ff.exists()) {
|
if (!ff.exists()) {
|
||||||
String libURL = l.getDownloadInfo().getUrl(service.getDownloadType());
|
String libURL = l.getDownloadInfo().getUrl(service.getDownloadType());
|
||||||
|
|||||||
@@ -89,6 +89,8 @@ public class MinecraftLibrary extends IMinecraftLibrary {
|
|||||||
|
|
||||||
public String formatName() {
|
public String formatName() {
|
||||||
String[] s = name.split(":");
|
String[] s = name.split(":");
|
||||||
|
if (s.length < 3)
|
||||||
|
return null;
|
||||||
StringBuilder sb = new StringBuilder(s[0].replace('.', '/')).append('/').append(s[1]).append('/').append(s[2]).append('/').append(s[1]).append('-').append(s[2]);
|
StringBuilder sb = new StringBuilder(s[0].replace('.', '/')).append('/').append(s[1]).append('/').append(s[2]).append('/').append(s[1]).append('-').append(s[2]);
|
||||||
if (natives != null)
|
if (natives != null)
|
||||||
sb.append('-').append(getNative());
|
sb.append('-').append(getNative());
|
||||||
@@ -120,8 +122,11 @@ public class MinecraftLibrary extends IMinecraftLibrary {
|
|||||||
downloads.artifact = info = new LibraryDownloadInfo();
|
downloads.artifact = info = new LibraryDownloadInfo();
|
||||||
else
|
else
|
||||||
info = downloads.artifact;
|
info = downloads.artifact;
|
||||||
if (StrUtils.isBlank(info.path))
|
if (StrUtils.isBlank(info.path)) {
|
||||||
info.path = formatName();
|
info.path = formatName();
|
||||||
|
if (info.path == null)
|
||||||
|
return null;
|
||||||
|
}
|
||||||
info.forgeURL = this.url;
|
info.forgeURL = this.url;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler {
|
|||||||
put("MessageBox", "");
|
put("MessageBox", "");
|
||||||
put("AWTError", "");
|
put("AWTError", "");
|
||||||
put("JFileChooser", "Has your operating system been installed completely or is a ghost system? ");
|
put("JFileChooser", "Has your operating system been installed completely or is a ghost system? ");
|
||||||
put("JceSecurity", "Has your operating system been installed completely or is a ghost system? ");
|
put("Jce", "Has your operating system been installed completely or is a ghost system? ");
|
||||||
put("couldn't create component peer", "Fucking computer!");
|
put("couldn't create component peer", "Fucking computer!");
|
||||||
put("sun.awt.shell.Win32ShellFolder2", "crash.user_fault");
|
put("sun.awt.shell.Win32ShellFolder2", "crash.user_fault");
|
||||||
put("UnsatisfiedLinkError", "crash.user_fault");
|
put("UnsatisfiedLinkError", "crash.user_fault");
|
||||||
|
|||||||
@@ -322,7 +322,8 @@ public class TaskWindow extends javax.swing.JDialog
|
|||||||
boolean flag;
|
boolean flag;
|
||||||
|
|
||||||
public TaskWindowFactory append(Task t) {
|
public TaskWindowFactory append(Task t) {
|
||||||
ll.add(t);
|
if (t != null)
|
||||||
|
ll.add(t);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user