Fixed bad allocation
This commit is contained in:
parent
fd589b416f
commit
9c1160ca2c
@ -50,10 +50,16 @@ public class ProtocolMessage {
|
|||||||
|
|
||||||
private void deconstructPacket(char[] raw){
|
private void deconstructPacket(char[] raw){
|
||||||
byte[] rawLength = new byte[4];
|
byte[] rawLength = new byte[4];
|
||||||
System.arraycopy(raw, 0, rawLength, 0, 4);
|
rawLength[0] = (byte)raw[0];
|
||||||
System.arraycopy(raw, 4, this.message, 0, message.length);
|
rawLength[1] = (byte)raw[1];
|
||||||
|
rawLength[2] = (byte)raw[2];
|
||||||
|
rawLength[3] = (byte)raw[3];
|
||||||
|
|
||||||
this.length = byteToInt(rawLength);
|
this.length = byteToInt(rawLength);
|
||||||
|
|
||||||
|
this.message = new char[length];
|
||||||
|
System.arraycopy(raw, 4, this.message, 0, message.length);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLength() {
|
public int getLength() {
|
||||||
|
Loading…
Reference in New Issue
Block a user