Fix NPE in donor perk packet
This commit is contained in:
@@ -47,12 +47,13 @@ public class PacketRequestDonationPerks implements IMessageHandler<PacketRequest
|
|||||||
@Override
|
@Override
|
||||||
public void fromBytes(ByteBuf buf){
|
public void fromBytes(ByteBuf buf){
|
||||||
// The order is important
|
// The order is important
|
||||||
element = Element.values()[buf.readShort()];
|
int i = buf.readShort();
|
||||||
|
element = i == -1 ? null : Element.values()[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toBytes(ByteBuf buf){
|
public void toBytes(ByteBuf buf){
|
||||||
buf.writeShort(element.ordinal());
|
buf.writeShort(element == null ? -1 : element.ordinal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user