summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-03-21 13:07:03 -0400
committerMichael <[email protected]>2017-03-21 13:07:03 -0400
commitbf85c3cda26d1ca3603d0a72e1cd3330335a73b1 (patch)
tree714037bfdcc9a2647b397f6c38b58cfcaf443355
parent4654aaea6b03424e93c10137b302e4b13f5e44b1 (diff)
downloadproject-unite-bf85c3cda26d1ca3603d0a72e1cd3330335a73b1.tar.gz
project-unite-bf85c3cda26d1ca3603d0a72e1cd3330335a73b1.tar.bz2
project-unite-bf85c3cda26d1ca3603d0a72e1cd3330335a73b1.zip
Another ACL bug.
-rw-r--r--Project-Unite/ACL.cs12
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>");
+ }
}
}