mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2025-02-21 06:52:23 +01:00
Don't attempt to add NULL keys to a ConcurrentHashMap. Fixes #21
This commit is contained in:
parent
23ebcb47ab
commit
aa3600a337
@ -6,6 +6,7 @@ import java.util.Set;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.injector.packet.PacketRegistry;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.util.com.google.common.collect.Maps;
|
||||
|
||||
@ -32,8 +33,12 @@ public class PacketTypeSet {
|
||||
* @param type - the type to add.
|
||||
*/
|
||||
public synchronized void addType(PacketType type) {
|
||||
types.add(type);
|
||||
classes.add(getPacketClass(type));
|
||||
Class<?> packetClass = getPacketClass(type);
|
||||
types.add(Preconditions.checkNotNull(type, "type cannot be NULL."));
|
||||
|
||||
if (packetClass != null) {
|
||||
classes.add(getPacketClass(type));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -41,8 +46,12 @@ public class PacketTypeSet {
|
||||
* @param type - the type to remove.
|
||||
*/
|
||||
public synchronized void removeType(PacketType type) {
|
||||
types.remove(type);
|
||||
classes.remove(getPacketClass(type));
|
||||
Class<?> packetClass = getPacketClass(type);
|
||||
types.remove(Preconditions.checkNotNull(type, "type cannot be NULL."));
|
||||
|
||||
if (packetClass != null) {
|
||||
classes.remove(getPacketClass(type));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user