From ad4dcf63f39a2af7ec50e4986dbfdc8c08b375b6 Mon Sep 17 00:00:00 2001 From: vfrz Date: Fri, 17 May 2024 19:05:02 +0200 Subject: [PATCH] Allow empty name only for root compound tag --- SharpNBT/TagWriter.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SharpNBT/TagWriter.cs b/SharpNBT/TagWriter.cs index 37a20ca..38bb4ab 100644 --- a/SharpNBT/TagWriter.cs +++ b/SharpNBT/TagWriter.cs @@ -309,6 +309,9 @@ public class TagWriter : TagIO if (tag.Parent is ListTag) return; + if (string.IsNullOrEmpty(tag.Name) && !(tag is CompoundTag && tag.Parent is null)) + return; + BaseStream.WriteByte((byte) tag.Type); WriteUTF8String(tag.Name); }