Fix NPE with MOTD (#1921)

This commit is contained in:
Camotoy 2021-02-12 14:16:29 -05:00 committed by GitHub
parent 25dd651b09
commit 98b2a0e51b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -95,6 +95,13 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
pong.setMaximumPlayerCount(config.getMaxPlayers()); pong.setMaximumPlayerCount(config.getMaxPlayers());
} }
if (pong.getMotd() == null) {
pong.setMotd("");
}
if (pong.getSubMotd() == null) {
pong.setSubMotd("");
}
// The ping will not appear if the MOTD + sub-MOTD is of a certain length. // The ping will not appear if the MOTD + sub-MOTD is of a certain length.
// We don't know why, though // We don't know why, though
byte[] motdArray = pong.getMotd().getBytes(StandardCharsets.UTF_8); byte[] motdArray = pong.getMotd().getBytes(StandardCharsets.UTF_8);