You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The plugin can cause a java.lang.NullPointerException when a player is trying to open a GUI.
In PlayerManager.findPlayer method there is a possibility that the method returns null if createError != null
publicSkullUserfindPlayer(@NonNullfinalUUIDuuid) {
finalAtomicReference<SkullUser> skullUser = newAtomicReference<>(this.players.getOrDefault(uuid, null));
if (skullUser.get() != null) returnskullUser.get();
Skulls.getDataManager().insertPlayer(newSkullPlayer(uuid, newArrayList<>()), (createError, created) -> {
// Oh no, an error has happened....if (createError == null) { // That's why we are skipping this part...addPlayer(created);
skullUser.set(created);
}
// error is not handled in any meaningful way, the user is not aware that something wrong has happened...
});
// That's why we return null...returnskullUser.get();
}
This messes up with SkullsViewGUI constructor, because the result of PlayerManager.findPlayer is passed there as is at many places, and it will throw a java.lang.NullPointerException exception
publicSkullsViewGUI(finalGuiparent, finalSkullUserskullPlayer/* == null */, finalStringcategory, finalViewModeviewMode) {
/* ... */this.skullPlayer = skullPlayer;
this.player = Bukkit.getPlayer(this.skullPlayer.getUUID()); // <- Oops!// A NullPointerException happened and is not caught, now it is all over the logs, the user is confused...draw();
}
I can't really suggest a good way to fix this, since I'm not fully familiar with the code base yet, but I think you would like to be aware of this problem.
The text was updated successfully, but these errors were encountered:
The plugin can cause a
java.lang.NullPointerException
when a player is trying to open a GUI.In
PlayerManager.findPlayer
method there is a possibility that the method returnsnull
ifcreateError != null
This messes up with
SkullsViewGUI
constructor, because the result ofPlayerManager.findPlayer
is passed there as is at many places, and it will throw ajava.lang.NullPointerException
exceptionI can't really suggest a good way to fix this, since I'm not fully familiar with the code base yet, but I think you would like to be aware of this problem.
The text was updated successfully, but these errors were encountered: