Skip to content

Commit

Permalink
Merge pull request #33 from vfrz/master
Browse files Browse the repository at this point in the history
Fixed bug where top-level compound tags without a name would be skipped by the TagWriter.
  • Loading branch information
ForeverZer0 authored May 17, 2024
2 parents d6e0075 + ad4dcf6 commit bd80810
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions SharpNBT/TagWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,10 @@ public override async ValueTask DisposeAsync()
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void WriteTypeAndName(Tag tag)
{
if (tag.Parent is ListTag || string.IsNullOrEmpty(tag.Name))
if (tag.Parent is ListTag)

Check warning on line 309 in SharpNBT/TagWriter.cs

View workflow job for this annotation

GitHub Actions / .NET 7.0.x

'Tag.Parent' is obsolete: 'Parent property may be removed in a future version.'
return;

if (string.IsNullOrEmpty(tag.Name) && !(tag is CompoundTag && tag.Parent is null))

Check warning on line 312 in SharpNBT/TagWriter.cs

View workflow job for this annotation

GitHub Actions / .NET 7.0.x

'Tag.Parent' is obsolete: 'Parent property may be removed in a future version.'
return;

BaseStream.WriteByte((byte) tag.Type);
Expand Down Expand Up @@ -384,4 +387,4 @@ private void WriteCount(int count)
else
BaseStream.Write(GetBytes(count), 0, sizeof(int));
}
}
}

0 comments on commit bd80810

Please sign in to comment.