diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c index 1e3f3bd1c8..33dbc7d5d5 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c @@ -361,6 +361,10 @@ HiiGetImageInfo ( // Find the image block specified by ImageId // CurrentImageBlock = GetImageIdOrAddress (ImagePackage->ImageBlock, &ImageId); + if (CurrentImageBlock == NULL) { + return EFI_NOT_FOUND; + } + switch (CurrentImageBlock->BlockType) { case EFI_HII_IIBT_IMAGE_JPEG: case EFI_HII_IIBT_IMAGE_PNG: