From a91db057f3d376002184ee737198932f40ee57e1 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sat, 18 Apr 2009 19:10:42 +0000 Subject: - Ensure that arrays and dictionaries from prefs which are being upgraded are mutable --- Source/SPPreferenceController.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index 80f32e36..8ea4e7f0 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -187,14 +187,14 @@ // For versions prior to r567 (0.9.5), add a timestamp-based identifier to favorites and keychain entries if (recordedVersionNumber < 567 && [prefs objectForKey:@"favorites"]) { int i; - NSMutableArray *favoritesArray = [prefs objectForKey:@"favorites"]; + NSMutableArray *favoritesArray = [NSMutableArray arrayWithArray:[prefs objectForKey:@"favorites"]]; NSMutableDictionary *favorite; NSString *password, *keychainName, *keychainAccount; KeyChain *upgradeKeychain = [[KeyChain alloc] init]; // Cycle through the favorites, generating a timestamp-derived ID for each and renaming associated keychain items. for (i = 0; i < [favoritesArray count]; i++) { - favorite = [favoritesArray objectAtIndex:i]; + favorite = [NSMutableDictionary dictionaryWithDictionary:[favoritesArray objectAtIndex:i]]; if ([favorite objectForKey:@"id"]) continue; [favorite setObject:[NSNumber numberWithInt:[[NSString stringWithFormat:@"%f", [[NSDate date] timeIntervalSince1970]] hash]] forKey:@"id"]; keychainName = [NSString stringWithFormat:@"Sequel Pro : %@", [favorite objectForKey:@"name"]]; -- cgit v1.2.3