Skip to content

Commit b6476d2

Browse files
committed
use provided length in SlimeSerializer#readRawCompound
1 parent 9d0ee86 commit b6476d2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

slime-loader/src/main/java/net/roxymc/slime/serializer/SlimeSerializer.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,14 @@ protected CompoundBinaryTag readCompound(ByteArrayDataInput in) throws IOExcepti
150150
}
151151

152152
protected CompoundBinaryTag readRawCompound(int length, ByteArrayDataInput in) throws IOException {
153-
return length == 0 ? CompoundBinaryTag.empty() : BinaryTagIO.reader().read(in);
153+
if (length == 0) {
154+
return CompoundBinaryTag.empty();
155+
}
156+
157+
byte[] bytes = new byte[length];
158+
in.readFully(bytes);
159+
160+
return BinaryTagIO.reader().read(ByteStreams.newDataInput(bytes));
154161
}
155162

156163
protected <T extends CompoundBinaryTagHolder> T[] readCompoundArray(

0 commit comments

Comments
 (0)