Refine code and check null pointer error. Signed-off-by: ydong10 Reviewed-by: mdkinney
Refine code and check null pointer error.
Signed-off-by: ydong10
Reviewed-by: mdkinney

git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@12532 6f19259b-4bc3-4df7-8a09-765794883524

MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2