mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-29 02:18:07 +01:00
Check for null before accessing the current user details.
Identified while working on the unit tests. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
6b15a45cd9
commit
3f3302a6b4
@ -206,10 +206,10 @@ namespace XenAPI
|
|||||||
if (IsLocalSuperuser)
|
if (IsLocalSuperuser)
|
||||||
return Messages.AD_LOCAL_ROOT_ACCOUNT;
|
return Messages.AD_LOCAL_ROOT_ACCOUNT;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(CurrentUserDetails.UserDisplayName))
|
if (CurrentUserDetails != null && !string.IsNullOrEmpty(CurrentUserDetails.UserDisplayName))
|
||||||
return CurrentUserDetails.UserDisplayName.Ellipsise(50);
|
return CurrentUserDetails.UserDisplayName.Ellipsise(50);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(CurrentUserDetails.UserName))
|
if (CurrentUserDetails != null && !string.IsNullOrEmpty(CurrentUserDetails.UserName))
|
||||||
return CurrentUserDetails.UserName.Ellipsise(50);
|
return CurrentUserDetails.UserName.Ellipsise(50);
|
||||||
|
|
||||||
return Messages.UNKNOWN_AD_USER;
|
return Messages.UNKNOWN_AD_USER;
|
||||||
@ -223,7 +223,7 @@ namespace XenAPI
|
|||||||
if (IsLocalSuperuser)
|
if (IsLocalSuperuser)
|
||||||
return Messages.AD_LOCAL_ROOT_ACCOUNT;
|
return Messages.AD_LOCAL_ROOT_ACCOUNT;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(CurrentUserDetails.UserName))
|
if (CurrentUserDetails != null && !string.IsNullOrEmpty(CurrentUserDetails.UserName))
|
||||||
return CurrentUserDetails.UserName;
|
return CurrentUserDetails.UserName;
|
||||||
|
|
||||||
return UserSid;
|
return UserSid;
|
||||||
|
Loading…
Reference in New Issue
Block a user