Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7486

SkullMeta#setOwnerProfile(PlayerProfile) throws NPE if profile name is null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • None
    • 1.20.2
    • Yes

       

      public void setCustomSkullTexture(SkullMeta sm, String texture) {
        final URL url = SkinFile.getURLFromSkullBase64(texture);
      
        if (url != null) {
         final PlayerProfile profile = Bukkit.getServer().createPlayerProfile(UUID.randomUUID());
      
         profile.getTextures().setSkin(url);
         sm.setOwnerProfile(profile); // Line #564
        } else
         sm.setOwnerProfile(null);
      }

      Error:

      [16:11:30] [Server thread/INFO]: Environment: Environment[accountsHost=https://api.mojang.com, sessionHost=https://sessionserver.mojang.com, servicesHost=https://api.minecraftservices.com, name=PROD]
      [16:11:30] [Server thread/WARN]: java.lang.NullPointerException: Cannot invoke "String.isEmpty()" because the return value of "com.mojang.authlib.GameProfile.getName()" is null
      [16:11:30] [Server thread/WARN]:        at net.minecraft.nbt.GameProfileSerializer.a(SourceFile:98)
      [16:11:30] [Server thread/WARN]:        at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaSkull.setProfile(CraftMetaSkull.java:135)
      [16:11:30] [Server thread/WARN]:        at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaSkull.setOwnerProfile(CraftMetaSkull.java:247)
      [16:11:30] [Server thread/WARN]:        at de.marcely.bedwars.versions.R2_20.setCustomSkullTexture(R2_20.java:564)
       

       

       

            Unassigned Unassigned
            metallicgoat Metallic Goat
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: