Adds a null check to deserialization

This commit is contained in:
zontreck 2025-04-09 20:56:56 -07:00
parent 31dc02b425
commit 05b7d0e38f

View file

@ -3,8 +3,8 @@ package dev.zontreck.ase.profile;
import org.bukkit.configuration.ConfigurationSection;
public class PlayerProfile {
public PlayerPronouns pronouns;
public String nickname;
public PlayerPronouns pronouns = PlayerPronouns.TheyThem;
public String nickname = "";
public ConfigurationSection serialize(ConfigurationSection parent) {
ConfigurationSection profile = parent.createSection("profile");
@ -15,6 +15,8 @@ public class PlayerProfile {
}
public static PlayerProfile deserialize(ConfigurationSection section) {
if (section == null)
return new PlayerProfile();
String nick = "";
PlayerPronouns pronouns = PlayerPronouns.TheyThem;
if (section.contains("nickname")) {