Fix empty compound reading

This commit is contained in:
KennyTV 2020-08-13 08:31:06 +02:00
parent 0ec1116a9e
commit b0fc931ecd
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 7 additions and 3 deletions

View File

@ -65,6 +65,11 @@ import java.util.stream.IntStream;
public CompoundTag compound() throws StringTagParseException {
this.buffer.expect(Tokens.COMPOUND_BEGIN);
final CompoundTag compoundTag = new CompoundTag("");
if (this.buffer.peek() == Tokens.COMPOUND_END) {
this.buffer.take();
return compoundTag;
}
while (this.buffer.hasMore()) {
final String key = this.key();
final Tag tag = this.tag();

View File

@ -39,10 +39,9 @@ public class ComponentRewriter1_13 extends ComponentRewriter {
CompoundTag tag;
try {
tag = BinaryTagIO.readString(text);
} catch (IOException e) {
} catch (Exception e) {
Via.getPlatform().getLogger().warning("Error reading NBT in show_item:" + text);
e.printStackTrace();
return;
throw new RuntimeException(e);
}
CompoundTag itemTag = tag.get("tag");