The return value of GetImageIdOrAddress() could be NULL if the
ImageId is invalid. The patch fixes the bug to return EFI_NOT_FOUND
when GetImageIdOrAddress() returns NULL.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
// Find the image block specified by ImageId\r
//\r
CurrentImageBlock = GetImageIdOrAddress (ImagePackage->ImageBlock, &ImageId);\r
+ if (CurrentImageBlock == NULL) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
switch (CurrentImageBlock->BlockType) {\r
case EFI_HII_IIBT_IMAGE_JPEG:\r
case EFI_HII_IIBT_IMAGE_PNG:\r