From 9d4af8fce232b371165eaf4f2c2275886c21ff2b Mon Sep 17 00:00:00 2001 From: niruiyu Date: Thu, 22 Sep 2011 02:56:38 +0000 Subject: [PATCH] Return empty string when END device path is passed in to align the original behavior in order to keep backward compatibility. Signed-off-by: niruiyu Reviewed-by: erictian git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12402 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c b/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c index d169c4d0d5..d7cff207fe 100644 --- a/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c +++ b/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c @@ -1875,6 +1875,7 @@ ConvertDeviceNodeToText ( // DumpNode (&Str, (VOID *) DeviceNode, DisplayOnly, AllowShortcuts); + ASSERT (Str.Str != NULL); return Str.Str; } @@ -1959,5 +1960,9 @@ ConvertDevicePathToText ( DevPathNode = NextDevicePathNode (DevPathNode); } - return Str.Str; + if (Str.Str == NULL) { + return AllocateZeroPool (sizeof (CHAR16)); + } else { + return Str.Str; + } }