Skip to content

Commit

Permalink
Fix npe causes by null entry in render queue???
Browse files Browse the repository at this point in the history
  • Loading branch information
rainbowdashlabs committed Jan 24, 2024
1 parent b5780f7 commit 8a76d1a
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import org.bukkit.entity.Player;

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Objects;
import java.util.Queue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
Expand Down Expand Up @@ -95,7 +97,7 @@ public void process(Player player) {
public int packetQueueCount() {
// We copy the queue to avoid modification during counting.
// Synchronizing the queue would stop the worker from working properly
return new ArrayDeque<>(queue).stream().mapToInt(RenderSink::size).sum();
return new ArrayList<>(queue).stream().filter(Objects::nonNull).mapToInt(RenderSink::size).sum();
}

public int size() {
Expand Down

0 comments on commit 8a76d1a

Please sign in to comment.