Skip to content

Commit

Permalink
Fix NPE race condition in ServerListPingEvent
Browse files Browse the repository at this point in the history
Fixes GH-1473

If a ping is responded to prior to the server sample being populated
(pre-tick as an example) it can result in an NPE.
  • Loading branch information
BillyGalbreath authored and Zach Brown committed Sep 23, 2018
1 parent 004b92b commit 003c0e0
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -91,7 +91,7 @@ index 0000000000..350410527b
+
+ private StandardPaperServerListPingEventImpl(MinecraftServer server, NetworkManager networkManager, ServerPing ping) {
+ super(server, new PaperStatusClient(networkManager), ping.getServerData().getProtocolVersion(), server.server.getServerIcon());
+ this.originalSample = ping.getPlayers().getSample();
+ this.originalSample = ping.getPlayers() == null ? null : ping.getPlayers().getSample(); // GH-1473 - pre-tick race condition NPE
+ }
+
+ @Nonnull
Expand Down

0 comments on commit 003c0e0

Please sign in to comment.