diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c index 3f08cc84dc..7b26e4d27f 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c @@ -317,6 +317,7 @@ ShellMmLocateIoProtocol ( } *PciRootBridgeIo = NULL; + HandleBuffer = NULL; Status = gBS->LocateHandleBuffer ( ByProtocol, &gEfiPciRootBridgeIoProtocolGuid, @@ -324,7 +325,7 @@ ShellMmLocateIoProtocol ( &HandleCount, &HandleBuffer ); - if (EFI_ERROR (Status) || (HandleCount == 0)) { + if (EFI_ERROR (Status) || (HandleCount == 0) || (HandleBuffer == NULL)) { return FALSE; }