diff --git a/Library/DiscUtils.Fat/Directory.cs b/Library/DiscUtils.Fat/Directory.cs index 3feb3f4c..35dc9df1 100644 --- a/Library/DiscUtils.Fat/Directory.cs +++ b/Library/DiscUtils.Fat/Directory.cs @@ -420,9 +420,13 @@ internal void UpdateEntry(long id, DirectoryEntry entry) private void AddEntryRaw(long pos, DirectoryEntry entry) { _entries.Add(pos, entry); + // Update the short and full name lookup tables - _shortFileNameToEntry.Add(entry.Name.ShortName, pos); - _fullFileNameToEntry.Add(entry.Name.FullName, pos); + if (!entry.Attributes.HasFlag(FatAttributes.VolumeId)) + { + _shortFileNameToEntry.Add(entry.Name.ShortName, pos); + _fullFileNameToEntry.Add(entry.Name.FullName, pos); + } } private void LoadEntries() diff --git a/Library/DiscUtils.Fat/FatFileSystemOptions.cs b/Library/DiscUtils.Fat/FatFileSystemOptions.cs index 5117ad19..2237413e 100644 --- a/Library/DiscUtils.Fat/FatFileSystemOptions.cs +++ b/Library/DiscUtils.Fat/FatFileSystemOptions.cs @@ -39,7 +39,7 @@ internal FatFileSystemOptions() internal FatFileSystemOptions(FileSystemParameters parameters) { - if (parameters.FileNameEncoding is not null) + if (parameters?.FileNameEncoding is not null) { FileNameEncoding = parameters.FileNameEncoding; }