mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Prevent NPE when serializing unresolved profile (#11407)
In the recent upstream update, the paper player profile was updated to correctly return null for both name and id if constructed as such. This change however broke the serialisation logic, as it depended on the name never being null. The commit moves the checks over to the newly introduced emptyName/UUID fields that track if the profile was constructed with a null name or uuid to differentiate it against an empty string or the NIL_UUID.
This commit is contained in:
parent
8569d1f04b
commit
85d19c8d5b
1 changed files with 2 additions and 2 deletions
|
@ -357,10 +357,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ @Override
|
||||
+ public @NotNull Map<String, Object> serialize() {
|
||||
+ Map<String, Object> map = new LinkedHashMap<>();
|
||||
+ if (this.getId() != null) {
|
||||
+ if (!this.emptyUUID) {
|
||||
+ map.put("uniqueId", this.getId().toString());
|
||||
+ }
|
||||
+ if (!this.getName().isEmpty()) {
|
||||
+ if (!this.emptyName) {
|
||||
+ map.put("name", getName());
|
||||
+ }
|
||||
+ if (!this.properties.isEmpty()) {
|
||||
|
|
Loading…
Reference in a new issue