MdeModulePkg/GraphicsConsoleDxe: Check status to make sure no error

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2668

SetMode will fail in some case. for example, without XServer.
Should handle these case when SetMode fail.

If we don't handle it, it will Segmentation fault.

Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
This commit is contained in:
Guomin Jiang 2022-02-20 14:53:01 +08:00 committed by mergify[bot]
parent dc39554d58
commit 906242343f
1 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
/** @file
This is the main routine for initializing the Graphics Console support routines.
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -518,7 +518,7 @@ GraphicsConsoleControllerDriverStart (
}
}
if (ModeNumber != Private->GraphicsOutput->Mode->Mode) {
if (EFI_ERROR (Status) || (ModeNumber != Private->GraphicsOutput->Mode->Mode)) {
//
// Current graphics mode is not set or is not set to the mode which we have found,
// set the new graphic mode.