diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c index 70852a93f2..cf89a4ac87 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -4071,7 +4071,7 @@ ShellFileHandleReturnLine( Status = ShellFileHandleReadLine(Handle, RetVal, &Size, FALSE, Ascii); } - if (Status == EFI_END_OF_FILE && *RetVal != CHAR_NULL) { + if (Status == EFI_END_OF_FILE && RetVal != NULL && *RetVal != CHAR_NULL) { Status = EFI_SUCCESS; } if (EFI_ERROR(Status) && (RetVal != NULL)) {