fix: crash when renaming game version

This commit is contained in:
huanghongxun
2020-04-23 08:12:19 +08:00
parent 43de254a98
commit 383de6cb2e
2 changed files with 8 additions and 4 deletions

View File

@@ -60,8 +60,12 @@ public class Versions {
}
public static CompletableFuture<String> renameVersion(Profile profile, String version) {
return Controllers.prompt(i18n("version.manage.rename.message"), (res, resolve, reject) -> {
if (profile.getRepository().renameVersion(version, res)) {
return Controllers.prompt(i18n("version.manage.rename.message"), (newName, resolve, reject) -> {
if (!OperatingSystem.isNameValid(newName)) {
reject.accept(i18n("install.new_game.malformed"));
return;
}
if (profile.getRepository().renameVersion(version, newName)) {
profile.getRepository().refreshVersionsAsync().start();
resolve.run();
} else {