Fixed and closed #438: group deletion no longer causes exceptions for former members.

This commit is contained in:
Dario Solera 2010-01-14 06:34:04 +00:00
parent ca12d536c4
commit 446934322c
3 changed files with 9 additions and 5 deletions

View file

@ -94,10 +94,13 @@ namespace ScrewTurn.Wiki {
if(groups == null || groups.Length == 0) {
UserInfo current = GetCurrentUser();
if(current != null) {
groups = new UserGroup[current.Groups.Length];
for(int i = 0; i < groups.Length; i++) {
groups[i] = Users.FindUserGroup(current.Groups[i]);
// This check is necessary because after group deletion the session might contain outdated data
List<UserGroup> temp = new List<UserGroup>(current.Groups.Length);
for(int i = 0; i < current.Groups.Length; i++) {
UserGroup tempGroup = Users.FindUserGroup(current.Groups[i]);
if(tempGroup != null) temp.Add(tempGroup);
}
groups = temp.ToArray();
}
else {
groups = new UserGroup[] { Users.FindUserGroup(Settings.AnonymousGroup) };