mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-05 22:52:13 -07:00
Do not NPE on uuid resolution in player profile (#11449)
Band-aid fix for the player profile api resolution for a profile with name but without uuid. The real solution is a proper refactoring of the completeFromCache and complete method internally, however this needs further consideration regarding existing faulty behaviour around name lookups from uuid-only profiles.
This commit is contained in:
@@ -250,6 +250,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // if old has it, assume its newer, so overwrite, else use cached if it was set and ours wasn't
|
+ // if old has it, assume its newer, so overwrite, else use cached if it was set and ours wasn't
|
||||||
+ copyProfileProperties(this.profile, profile);
|
+ copyProfileProperties(this.profile, profile);
|
||||||
+ this.profile = profile;
|
+ this.profile = profile;
|
||||||
|
+ this.emptyUUID = false; // UUID was just retrieved from user cache and profile isn't null (so a completed profile was found)
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@@ -261,6 +262,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // if old has it, assume its newer, so overwrite, else use cached if it was set and ours wasn't
|
+ // if old has it, assume its newer, so overwrite, else use cached if it was set and ours wasn't
|
||||||
+ copyProfileProperties(this.profile, profile);
|
+ copyProfileProperties(this.profile, profile);
|
||||||
+ this.profile = profile;
|
+ this.profile = profile;
|
||||||
|
+ this.emptyName = false; // Name was just retrieved via the userCache
|
||||||
+ } else if (profile != this.profile) {
|
+ } else if (profile != this.profile) {
|
||||||
+ copyProfileProperties(profile, this.profile);
|
+ copyProfileProperties(profile, this.profile);
|
||||||
+ }
|
+ }
|
||||||
@@ -281,7 +283,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ MinecraftServer server = MinecraftServer.getServer();
|
+ MinecraftServer server = MinecraftServer.getServer();
|
||||||
+ boolean isCompleteFromCache = this.completeFromCache(true, onlineMode);
|
+ boolean isCompleteFromCache = this.completeFromCache(true, onlineMode);
|
||||||
+ if (onlineMode && (!isCompleteFromCache || (textures && !hasTextures()))) {
|
+ if (onlineMode && (!isCompleteFromCache || (textures && !hasTextures()))) {
|
||||||
+ ProfileResult result = server.getSessionService().fetchProfile(this.getId(), true);
|
+ ProfileResult result = server.getSessionService().fetchProfile(this.profile.getId(), true);
|
||||||
+ if (result != null && result.profile() != null) {
|
+ if (result != null && result.profile() != null) {
|
||||||
+ copyProfileProperties(result.profile(), this.profile, true);
|
+ copyProfileProperties(result.profile(), this.profile, true);
|
||||||
+ }
|
+ }
|
||||||
|
Reference in New Issue
Block a user