diff --git a/src/LibHac/FsSystem/BucketTree.cs b/src/LibHac/FsSystem/BucketTree.cs index 44898782..9ecd8b65 100644 --- a/src/LibHac/FsSystem/BucketTree.cs +++ b/src/LibHac/FsSystem/BucketTree.cs @@ -541,6 +541,7 @@ public partial class BucketTree : IDisposable _entryStorage.Set(in entryStorage); _nodeSize = nodeSize; _entrySize = entrySize; + _entryCount = entryCount; _offsetCount = offsetCount; _entrySetCount = entrySetCount; _offsetCache.IsInitialized = true; diff --git a/tests/LibHac.Tests/FsSystem/BucketTreeTests.cs b/tests/LibHac.Tests/FsSystem/BucketTreeTests.cs index 988fe454..6445db32 100644 --- a/tests/LibHac.Tests/FsSystem/BucketTreeTests.cs +++ b/tests/LibHac.Tests/FsSystem/BucketTreeTests.cs @@ -182,4 +182,12 @@ public class BucketTreeTests : IClassFixture Assert.Equal(expectedEntry.StorageIndex, actualEntry.StorageIndex); } } + + [Theory, MemberData(nameof(BucketTreeTestTheoryData))] + private void GetEntryCount_ReturnsCorrectCount(int treeIndex) + { + BucketTree tree = _treeData[treeIndex].CreateBucketTree(); + + Assert.Equal(_treeData[treeIndex].EntryCount, tree.GetEntryCount()); + } } \ No newline at end of file