CatCoderr/ProtocolSidebar

NullPointer exception in pager

Closed this issue · 0 comments

Null pointer exception when join two players on the server:

Stacktrace:
java.util.ConcurrentModificationException: null
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1597) ~[?:?]
at java.util.HashMap$KeyIterator.next(HashMap.java:1620) ~[?:?]
at me.catcoder.sidebar.Sidebar.removeViewers(Sidebar.java:347) ~[GreenLibrary-1.0.0.b57.jar:?]
at me.catcoder.sidebar.pager.SidebarPager.switchPage(SidebarPager.java:51) ~[GreenLibrary-1.0.0.b57.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.2.jar:git-Paper-307]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1473) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:446) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1397) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1173) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-307]
at java.lang.Thread.run(Thread.java:833) ~[?:?]

i'm use a this code:
BoardStorage.pager = new SidebarPager<>(
BoardStorage.sidebars, 20L * settings.getPageShowTime(), instance
);

Then:
public static void show (Player player) {
if (pager != null) {
pager.show(player);
}
}