Reviewed-by: Ruiyu Ni <ruiyu...@intel.com>

Thanks/Ray

> -----Original Message-----
> From: Marvin Häuser <marvin.haeu...@outlook.com>
> Sent: Sunday, May 6, 2018 8:07 AM
> To: edk2-devel@lists.01.org
> Cc: Carsey, Jaben <jaben.car...@intel.com>; Ni, Ruiyu <ruiyu...@intel.com>
> Subject: [PATCH] ShellPkg/UefiShellCommandLib: Do not error-exit when
> PlatformLang is missing.
> 
> Currently, when the PlatformLang variable is missing, UefiShellCommandLib
> error-exits. To prevent the entire UEFI Shell from failing to load over a
> missing variable, "en-US" is assumed when the variable location fails.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marvin Haeuser <marvin.haeu...@outlook.com>
> ---
>  ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c | 9 ++++----
> -
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> index 0df252b42036..dfcfd2e0dd54 100644
> --- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> +++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> @@ -81,9 +81,6 @@ CommandInit(
>    CHAR8                           *PlatformLang;
> 
>    GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME,
> (VOID**)&PlatformLang, NULL);
> -  if (PlatformLang == NULL) {
> -    return EFI_UNSUPPORTED;
> -  }
> 
>    if (gUnicodeCollation == NULL) {
>      Status = gBS->LocateHandleBuffer (
> @@ -120,7 +117,7 @@ CommandInit(
>        BestLanguage = GetBestLanguage (
>                         Uc->SupportedLanguages,
>                         FALSE,
> -                       PlatformLang,
> +                       ((PlatformLang != NULL) ? PlatformLang :
> + "en-US"),
>                         NULL
>                         );
>        if (BestLanguage != NULL) {
> @@ -132,7 +129,9 @@ CommandInit(
>      if (Handles != NULL) {
>        FreePool (Handles);
>      }
> -    FreePool (PlatformLang);
> +    if (PlatformLang != NULL) {
> +      FreePool (PlatformLang);
> +    }
>    }
> 
>    return (gUnicodeCollation == NULL) ? EFI_UNSUPPORTED : EFI_SUCCESS;
> --
> 2.17.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to