Add additional handling to ensure entities is not null when written

This commit is contained in:
William 2023-02-25 12:55:40 +00:00
parent 39b196b647
commit de747bf3eb
No known key found for this signature in database

View File

@ -108,8 +108,8 @@ public class UpdateTeamsPacket extends AbstractPacket {
ProtocolUtil.writeString(byteBuf, suffix);
}
if (mode == UpdateMode.CREATE_TEAM || mode == UpdateMode.ADD_PLAYERS || mode == UpdateMode.REMOVE_PLAYERS) {
ProtocolUtil.writeVarInt(byteBuf, entities.size());
for (String entity : entities) {
ProtocolUtil.writeVarInt(byteBuf, entities != null ? entities.size() : 0);
for (String entity : entities != null ? entities : new ArrayList<String>()) {
ProtocolUtil.writeString(byteBuf, entity);
}
}