diff options
Diffstat (limited to 'MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystem.c')
-rw-r--r-- | MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystem.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystem.c b/MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystem.c index c6137aca1f..b81110ff98 100644 --- a/MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystem.c +++ b/MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystem.c @@ -526,7 +526,10 @@ FvSimpleFileSystemOpen ( InitializeListHead (&NewFile->Link);
InsertHeadList (&Instance->FileHead, &NewFile->Link);
- NewFile->DirReadNext = FVFS_GET_FIRST_FILE_INFO (Instance);
+ NewFile->DirReadNext = NULL;
+ if (!IsListEmpty (&Instance->FileInfoHead)) {
+ NewFile->DirReadNext = FVFS_GET_FIRST_FILE_INFO (Instance);
+ }
*NewHandle = &NewFile->FileProtocol;
return EFI_SUCCESS;
@@ -821,7 +824,9 @@ FvSimpleFileSystemSetPosition ( //
// Reset directory position to first entry
//
- File->DirReadNext = FVFS_GET_FIRST_FILE_INFO (Instance);
+ if (File->DirReadNext) {
+ File->DirReadNext = FVFS_GET_FIRST_FILE_INFO (Instance);
+ }
} else if (Position == 0xFFFFFFFFFFFFFFFFull) {
File->Position = File->FvFileInfo->FileInfo.FileSize;
} else {
|