diff options
Diffstat (limited to 'Project-Unite')
| -rw-r--r-- | Project-Unite/ACL.cs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Project-Unite/ACL.cs b/Project-Unite/ACL.cs index aca67a5..df57671 100644 --- a/Project-Unite/ACL.cs +++ b/Project-Unite/ACL.cs @@ -46,9 +46,15 @@ namespace Project_Unite { userRoles.Add(db.Roles.FirstOrDefault(r => r.Id == usrRole.RoleId) as Role); } - var userRole = userRoles.OrderByDescending(m => m.Priority).First(); - return hpr.Raw($@"<strong style=""color:{userRole.ColorHex}"">{hpr.Encode(usr.DisplayName)}</strong>"); - + var userRole = userRoles.OrderByDescending(m => m.Priority).FirstOrDefault(); + if (userRole == null) + { + return hpr.Raw($@"<strong>{hpr.Encode(usr.DisplayName)}</strong>"); + } + else + { + return hpr.Raw($@"<strong style=""color:{userRole.ColorHex}"">{hpr.Encode(usr.DisplayName)}</strong>"); + } } } |
