]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c
1) Initialize gBS, gST, gImageHandle in UefiBootServicesTableLib.c to NULL
[mirror_edk2.git] / MdePkg / Library / DxeReportStatusCodeLib / ReportStatusCodeLib.c
index 4e140c61c85a7cb6c85f1123c79e5dfd5faf91c4..28649f72cc3b126f8d433edea2c07414cdbedc6b 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Report Status Code Library for DXE Phase.\r
 \r
-  Copyright (c) 2006, Intel Corporation<BR>\r
+  Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
   All rights reserved. This program and the accompanying materials                          \r
   are licensed and made available under the terms and conditions of the BSD License         \r
   which accompanies this distribution.  The full text of the license may be found at        \r
@@ -57,6 +57,9 @@ InternalReportStatusCode (
   // in the handle database.\r
   //\r
   if (gStatusCode == NULL) {\r
+    if (gBS == NULL) {\r
+      return EFI_UNSUPPORTED;\r
+    }\r
     Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode);\r
     if (EFI_ERROR (Status) || gStatusCode == NULL) {\r
       return EFI_UNSUPPORTED;\r
@@ -476,6 +479,10 @@ ReportStatusCodeEx (
   ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));\r
   ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));\r
 \r
+  if (gBS == NULL) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
   //\r
   // Allocate space for the Status Code Header and its buffer\r
   //\r