Update for IntelFrameworkModulePkg.
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / BootMaint / Variable.c
index ac7e614..c4b83ba 100644 (file)
@@ -673,14 +673,13 @@ Var_UpdateDriverOption (
                       &gEfiGlobalVariableGuid,\r
                       &DriverOrderListSize\r
                       );\r
-  ASSERT (DriverOrderList != NULL);\r
   NewDriverOrderList = AllocateZeroPool (DriverOrderListSize + sizeof (UINT16));\r
   ASSERT (NewDriverOrderList != NULL);\r
-  CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);\r
-  NewDriverOrderList[DriverOrderListSize / sizeof (UINT16)] = Index;\r
   if (DriverOrderList != NULL) {\r
+    CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);\r
     EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);\r
   }\r
+  NewDriverOrderList[DriverOrderListSize / sizeof (UINT16)] = Index;\r
 \r
   Status = gRT->SetVariable (\r
                   L"DriverOrder",\r