ShellPkg: Add checks for NULL pointers.

This adds lots of pointer verification with ASSERTs only used when the condition should be impossible and never for memory allocation.

signed-off-by: jcarsey
reviewed-by: geekboy15a

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12523 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jcarsey
2011-10-10 20:32:17 +00:00
parent beab0fc5e2
commit ecae51177e
9 changed files with 56 additions and 21 deletions

View File

@ -36,6 +36,7 @@ ShellCommandRunEdit (
CONST CHAR16 *Cwd;
CHAR16 *Nfs;
CHAR16 *Spot;
CONST CHAR16 *TempParam;
// SHELL_FILE_HANDLE TempHandle;
Buffer = NULL;
@ -101,7 +102,9 @@ ShellCommandRunEdit (
// if editor launched with file named
//
if (ShellCommandLineGetCount(Package) == 2) {
FileBufferSetFileName (ShellCommandLineGetRawValue(Package, 1));
TempParam = ShellCommandLineGetRawValue(Package, 1);
ASSERT(TempParam != NULL);
FileBufferSetFileName (TempParam);
// if (EFI_ERROR(ShellFileExists(MainEditor.FileBuffer->FileName))) {
// Status = ShellOpenFileByName(MainEditor.FileBuffer->FileName, &TempHandle, EFI_FILE_MODE_CREATE|EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0);
// if (!EFI_ERROR(Status)) {