diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/Versions.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/Versions.java index e52b444d1..83bbb7205 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/Versions.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/Versions.java @@ -130,6 +130,10 @@ public final class Versions { public static CompletableFuture renameVersion(Profile profile, String version) { return Controllers.prompt(i18n("version.manage.rename.message"), (newName, resolve, reject) -> { + if (newName.equals(version)) { + resolve.run(); + return; + } if (profile.getRepository().renameVersion(version, newName)) { resolve.run(); profile.getRepository().refreshVersionsAsync() @@ -142,7 +146,7 @@ public final class Versions { reject.accept(i18n("version.manage.rename.fail")); } }, version, new Validator(i18n("install.new_game.malformed"), HMCLGameRepository::isValidVersionId), - new Validator(i18n("install.new_game.already_exists"), newVersionName -> !profile.getRepository().versionIdConflicts(newVersionName))); + new Validator(i18n("install.new_game.already_exists"), newVersionName -> !profile.getRepository().versionIdConflicts(newVersionName) || newVersionName.equals(version))); } public static void exportVersion(Profile profile, String version) {