IN VOID *Context\r
)\r
{\r
- EFI_STATUS Status;\r
- UINTN BufferSize;\r
- EFI_HANDLE EmuHandle;\r
- EMULATOR_ENTRY *Entry;\r
+ EFI_STATUS Status;\r
+ UINTN BufferSize;\r
+ EFI_HANDLE EmuHandle;\r
+ EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *Emulator;\r
+ EMULATOR_ENTRY *Entry;\r
\r
EmuHandle = NULL;\r
+ Emulator = NULL;\r
\r
while (TRUE) {\r
BufferSize = sizeof (EmuHandle);\r
return;\r
}\r
\r
- Entry = AllocateZeroPool (sizeof (*Entry));\r
- ASSERT (Entry != NULL);\r
-\r
Status = CoreHandleProtocol (\r
EmuHandle,\r
&gEdkiiPeCoffImageEmulatorProtocolGuid,\r
- (VOID **)&Entry->Emulator\r
+ (VOID **)&Emulator\r
);\r
- ASSERT_EFI_ERROR (Status);\r
+ if (EFI_ERROR (Status) || Emulator == NULL) {\r
+ continue;\r
+ }\r
+\r
+ Entry = AllocateZeroPool (sizeof (*Entry));\r
+ ASSERT (Entry != NULL);\r
\r
+ Entry->Emulator = Emulator;\r
Entry->MachineType = Entry->Emulator->MachineType;\r
\r
InsertTailList (&mAvailableEmulators, &Entry->Link);\r