Fix stuck on startup when no suitable Java is found (#1671)

This commit is contained in:
Glavo 2022-08-29 19:27:51 +08:00 committed by GitHub
parent 3c3c28aaa5
commit b5c92c1564
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -369,7 +369,11 @@ public final class LauncherHelper {
} }
} }
if (targetJavaVersion != null) { if (targetJavaVersion == null) {
Controllers.confirm(i18n("launch.failed.no_accepted_java"), i18n("message.warning"), MessageType.WARNING, continueAction, () -> {
future.completeExceptionally(new CancellationException("No accepted java"));
});
} else {
downloadJava(gameVersion.toString(), targetJavaVersion, profile) downloadJava(gameVersion.toString(), targetJavaVersion, profile)
.thenAcceptAsync(downloadedJavaVersion -> { .thenAcceptAsync(downloadedJavaVersion -> {
future.complete(downloadedJavaVersion); future.complete(downloadedJavaVersion);