From e7919e3db8c8e4c5b170e5f64d4f5b61609db002 Mon Sep 17 00:00:00 2001 From: Jeremy Powell Date: Mon, 7 Oct 2024 11:58:48 +1300 Subject: [PATCH] Throw if root directory entry is invalid --- sources/OpenMcdf/CompoundFile.cs | 38 +++----------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/sources/OpenMcdf/CompoundFile.cs b/sources/OpenMcdf/CompoundFile.cs index 7b9374c4..bf5de1c0 100644 --- a/sources/OpenMcdf/CompoundFile.cs +++ b/sources/OpenMcdf/CompoundFile.cs @@ -1502,44 +1502,12 @@ internal List 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 levelSIDs = new List(); + 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 levelSIDs = new List(); - LoadChildren(bst, child, levelSIDs); - } - } - } - private static void NullifyChildNodes(IDirectoryEntry de) { de.Parent = null;