mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-02-25 19:26:24 +00:00
fix(preferences): Fix NSException issue when SOGoCreateIdentitiesDisabled is set
This commit is contained in:
@@ -833,6 +833,7 @@
|
||||
{
|
||||
// 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];
|
||||
}
|
||||
|
||||
@@ -1348,6 +1348,7 @@ static NSArray *reminderValues = nil;
|
||||
NSMutableArray *previousIdentities, *newIdentities;
|
||||
NSMutableDictionary *identity, *newIdentitiesAsDict;
|
||||
int i;
|
||||
BOOL isDefault;
|
||||
|
||||
if ([account isKindOfClass: [NSDictionary class]])
|
||||
{
|
||||
@@ -1372,9 +1373,15 @@ static NSArray *reminderValues = nil;
|
||||
// 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--;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user