Allow empty name only for root compound tag

This commit is contained in:
vfrz 2024-05-17 19:05:02 +02:00
parent 7f020e1c51
commit ad4dcf63f3
1 changed files with 3 additions and 0 deletions

View File

@ -309,6 +309,9 @@ public class TagWriter : TagIO
if (tag.Parent is ListTag) if (tag.Parent is ListTag)
return; return;
if (string.IsNullOrEmpty(tag.Name) && !(tag is CompoundTag && tag.Parent is null))
return;
BaseStream.WriteByte((byte) tag.Type); BaseStream.WriteByte((byte) tag.Type);
WriteUTF8String(tag.Name); WriteUTF8String(tag.Name);
} }