Do not copy profile data if profiles are the same (#10259)

This commit is contained in:
Shane Freeder 2024-03-20 21:47:50 +00:00
parent b17ca0b19e
commit 5efed01031

View File

@ -236,7 +236,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // if old has it, assume its newer, so overwrite, else use cached if it was set and ours wasn't
+ copyProfileProperties(this.profile, profile);
+ this.profile = profile;
+ } else {
+ } else if (profile != this.profile) {
+ copyProfileProperties(profile, this.profile);
+ }
+ }
@ -267,6 +267,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ private static void copyProfileProperties(GameProfile source, GameProfile target, boolean clearTarget) {
+ if (source == target) {
+ throw new IllegalArgumentException("Source and target profiles are the same (" + source + ")");
+ }
+ PropertyMap sourceProperties = source.getProperties();
+ PropertyMap targetProperties = target.getProperties();
+ if (clearTarget) targetProperties.clear();