Prevent NPE when creating a Team without any entity

This commit is contained in:
themode 2021-01-03 23:01:41 +01:00
parent f13646fd0d
commit f2f9cbc5fa

View File

@ -80,7 +80,11 @@ public class TeamsPacket implements ServerPacket {
}
if (action == Action.CREATE_TEAM || action == Action.ADD_PLAYERS_TEAM || action == Action.REMOVE_PLAYERS_TEAM) {
writer.writeStringArray(entities);
if (entities == null || entities.length == 0) {
writer.writeVarInt(0); // Empty
} else {
writer.writeStringArray(entities);
}
}
}