MdeModulePkg/FvSimpleFileSystem: fix assertions when FV is empty

The original code will assert when dealing with those empty FVs.
The fix is used to solve this bug.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
This commit is contained in:
Feng Tian
2016-08-02 16:07:23 +08:00
parent 846ea5f537
commit ebd2be6875
2 changed files with 12 additions and 3 deletions

View File

@ -223,7 +223,11 @@ FvSimpleFileSystemOpenVolume (
}
}
Instance->Root->DirReadNext = FVFS_GET_FIRST_FILE_INFO (Instance);
Instance->Root->DirReadNext = NULL;
if (!IsListEmpty (&Instance->FileInfoHead)) {
Instance->Root->DirReadNext = FVFS_GET_FIRST_FILE_INFO (Instance);
}
*RootFile = &Instance->Root->FileProtocol;
return Status;
}