13
0
geforkt von Mirrors/Paper

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.
Dieser Commit ist enthalten in:
Bjarne Koll 2024-09-16 20:53:00 +02:00
Ursprung 8569d1f04b
Commit 85d19c8d5b

Datei anzeigen

@ -357,10 +357,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override + @Override
+ public @NotNull Map<String, Object> serialize() { + public @NotNull Map<String, Object> serialize() {
+ Map<String, Object> map = new LinkedHashMap<>(); + Map<String, Object> map = new LinkedHashMap<>();
+ if (this.getId() != null) { + if (!this.emptyUUID) {
+ map.put("uniqueId", this.getId().toString()); + map.put("uniqueId", this.getId().toString());
+ } + }
+ if (!this.getName().isEmpty()) { + if (!this.emptyName) {
+ map.put("name", getName()); + map.put("name", getName());
+ } + }
+ if (!this.properties.isEmpty()) { + if (!this.properties.isEmpty()) {