Skip to content

Commit

Permalink
Throw if root directory entry is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-visionaid committed Oct 7, 2024
1 parent 4a58717 commit e7919e3
Showing 1 changed file with 3 additions and 35 deletions.
38 changes: 3 additions & 35 deletions sources/OpenMcdf/CompoundFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1502,44 +1502,12 @@ internal List<Sector> GetSectorChain(int secID, SectorType chainType)

internal RBTree GetChildrenTree(IDirectoryEntry entry)
{
RBTree bst = new RBTree();

// Load children from their original tree.
LoadChildren(bst, entry);
//bst = DoLoadChildrenTrusted(directoryEntries[sid]);

//bst.Print();
//bst.Print();
//Trace.WriteLine("#### After rethreading");

return bst;
}

private RBTree DoLoadChildrenTrusted(IDirectoryEntry de)
{
RBTree bst = null;

if (de.Child != DirectoryEntry.NOSTREAM)
{
bst = new RBTree(directoryEntries[de.Child]);
}

RBTree bst = new();
List<int> levelSIDs = new List<int>();
LoadChildren(bst, entry.Child, levelSIDs);
return bst;
}

private void LoadChildren(RBTree bst, IDirectoryEntry de)
{
if (de.Child != DirectoryEntry.NOSTREAM)
{
IDirectoryEntry child = directoryEntries[de.Child];
if (child.StgType != StgType.StgInvalid)
{
List<int> levelSIDs = new List<int>();
LoadChildren(bst, child, levelSIDs);
}
}
}

private static void NullifyChildNodes(IDirectoryEntry de)
{
de.Parent = null;
Expand Down

0 comments on commit e7919e3

Please sign in to comment.