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
1 changed files with 7 additions and 0 deletions

View File

@ -95,6 +95,13 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
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.
// We don't know why, though
byte[] motdArray = pong.getMotd().getBytes(StandardCharsets.UTF_8);