NPE when calling getBossBar() on plugin spawned EnderDragon

    • Type: New Feature
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None
    • 1.17.1
    • Yes

      Some EnderDragons may not have a dragonFight, so they do not have a bossbar.

       

      Caused by: java.lang.NullPointerException: Cannot read field "k" because "this.handle" is null
      at org.bukkit.craftbukkit.v1_17_R1.boss.CraftDragonBattle.getBossBar(CraftDragonBattle.java:29)
      at org.bukkit.craftbukkit.v1_17_R1.entity.CraftEnderDragon.getBossBar(CraftEnderDragon.java:69)
      at de.iani.security.commands.SpawnMobWithoutAI.spawnMob(SpawnMobWithoutAI.java:99)
      at de.iani.security.commands.SpawnMobWithoutAI.onCommand(SpawnMobWithoutAI.java:68)
      at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)
      ... 21 more

       

      PR: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/925/overview

            Assignee:
            Unassigned
            Reporter:
            Brokkonaut
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: