MdeModulePkg/HiiDatabaseDxe: Add ASSERT before using the pointer 'String'

The 'Sting' is returned by the function GetUnicodeStringTextAndSize.
If it is NULL, function GetUnicodeStringTextAndSize will return
EFI_OUT_OF_RESOURCES, and error handling codes will cover it.
So the pointer 'Sting' can not be NULL when using it.
So we can add the ASSERT codes.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
This commit is contained in:
Dandan Bi 2016-06-24 13:19:14 +08:00 committed by Star Zeng
parent 631c942726
commit 763cfa739b
1 changed files with 4 additions and 4 deletions

View File

@ -875,7 +875,7 @@ GetStringIdFromString (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
goto Done; goto Done;
} }
ASSERT (String != NULL);
if (StrCmp(KeywordValue, String) == 0) { if (StrCmp(KeywordValue, String) == 0) {
*StringId = CurrentStringId; *StringId = CurrentStringId;
goto Done; goto Done;
@ -895,7 +895,7 @@ GetStringIdFromString (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
goto Done; goto Done;
} }
ASSERT (String != NULL);
if (StrCmp(KeywordValue, String) == 0) { if (StrCmp(KeywordValue, String) == 0) {
*StringId = CurrentStringId; *StringId = CurrentStringId;
goto Done; goto Done;
@ -914,7 +914,7 @@ GetStringIdFromString (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
goto Done; goto Done;
} }
ASSERT (String != NULL);
BlockSize += StringSize; BlockSize += StringSize;
if (StrCmp(KeywordValue, String) == 0) { if (StrCmp(KeywordValue, String) == 0) {
*StringId = CurrentStringId; *StringId = CurrentStringId;
@ -939,7 +939,7 @@ GetStringIdFromString (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
goto Done; goto Done;
} }
ASSERT (String != NULL);
BlockSize += StringSize; BlockSize += StringSize;
if (StrCmp(KeywordValue, String) == 0) { if (StrCmp(KeywordValue, String) == 0) {
*StringId = CurrentStringId; *StringId = CurrentStringId;