Skip to content

Commit

Permalink
fix(preferences): Fix NSException issue when SOGoCreateIdentitiesDisa…
Browse files Browse the repository at this point in the history
…bled is set
  • Loading branch information
WoodySlum committed Jun 20, 2023
1 parent 4177ec1 commit ef958f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions SoObjects/SOGo/SOGoUser.m
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@ - (void) _appendSystemMailAccountWithDelegatedIdentities: (BOOL) appendDeletegat
{
// This additional identity should not appear in the identity manager of the Preferences
[identity setObject: [NSNumber numberWithBool: YES] forKey: @"isReadOnly"];
[identity setObject: [NSNumber numberWithBool: NO] forKey: @"isDefault"];
}
[identities addObject: identity];
}
Expand Down
9 changes: 8 additions & 1 deletion UI/PreferencesUI/UIxPreferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,7 @@ - (void) _extractMainAccountSettings: (NSDictionary *) account
NSMutableArray *previousIdentities, *newIdentities;
NSMutableDictionary *identity, *newIdentitiesAsDict;
int i;
BOOL isDefault;

if ([account isKindOfClass: [NSDictionary class]])
{
Expand All @@ -1372,9 +1373,15 @@ - (void) _extractMainAccountSettings: (NSDictionary *) account
// Remove existing deleted identities
for (identity in [user allIdentities]) {
// Identity deleted and at least one identity and not the default identity
if ([identity objectForKey:@"isDefault"]) {
isDefault = [[identity objectForKey:@"isDefault"] boolValue];
} else {
isDefault = NO;
}

if (![newIdentitiesAsDict objectForKey: [identity objectForKey:@"email"]]
&& [previousIdentities count] > 1
&& ![identity boolForKey:@"isDefault"]) {
&& !isDefault) {
[previousIdentities removeObjectAtIndex: i];
i--;
}
Expand Down

0 comments on commit ef958f6

Please sign in to comment.