diff options
author | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-01-02 21:17:20 +0000 |
---|---|---|
committer | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-01-02 21:17:20 +0000 |
commit | 8fcf74a850146a18591d81bb488e48f8af5749b8 (patch) | |
tree | 4b21a7b6bf0c14dc10c0124ac4a139f31740d061 | |
parent | 1921657354d52f874679b9d117b37e6b36641abf (diff) | |
download | edk2-8fcf74a850146a18591d81bb488e48f8af5749b8.zip edk2-8fcf74a850146a18591d81bb488e48f8af5749b8.tar.gz edk2-8fcf74a850146a18591d81bb488e48f8af5749b8.tar.bz2 |
ShellPkg: print error when column index is out of range instead of ASSERT.
signed-off-by: jcarsey
reviewed-by: leegrosenbaum
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12904 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c index 1cdc9e3..4072b94 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c @@ -1,7 +1,7 @@ /** @file
Main file for Parse shell level 2 function.
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -91,22 +91,26 @@ PerformParsing( }
}
if (ColumnLoop == ColumnIndex) {
- ASSERT(ColumnPointer != NULL);
- TempSpot = StrStr(ColumnPointer, L",");
- if (TempSpot != NULL) {
- *TempSpot = CHAR_NULL;
+ if (ColumnPointer == NULL) {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"Column Index");
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ } else {
+ TempSpot = StrStr(ColumnPointer, L",");
+ if (TempSpot != NULL) {
+ *TempSpot = CHAR_NULL;
+ }
+ while (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L' '){
+ ColumnPointer++;
+ }
+ if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L'\"'){
+ ColumnPointer++;
+ }
+ if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[StrLen(ColumnPointer)-1] == L'\"'){
+ ColumnPointer[StrLen(ColumnPointer)-1] = CHAR_NULL;
+ }
+
+ ShellPrintEx(-1, -1, L"%s\r\n", ColumnPointer);
}
- while (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L' '){
- ColumnPointer++;
- }
- if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L'\"'){
- ColumnPointer++;
- }
- if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[StrLen(ColumnPointer)-1] == L'\"'){
- ColumnPointer[StrLen(ColumnPointer)-1] = CHAR_NULL;
- }
-
- ShellPrintEx(-1, -1, L"%s\r\n", ColumnPointer);
}
}
SHELL_FREE_NON_NULL(TempLine);
|