From a2c7f0a33464fd3558f328bc975b8f1fc3ca2dfe Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Mon, 7 Dec 2009 22:45:09 +0000 Subject: - Additional error checking when reading in query favorites to ensure a malformed favorite does not break application launch - Move favorites update routine to a later revision check to upgrade any query favorites created by dual use of 0.9.6 and nightlies --- Source/CustomQuery.m | 1 + Source/SPPreferenceController.m | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'Source') diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index e620aba5..a1922f8f 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -2650,6 +2650,7 @@ [menu addItem:headerMenuItem]; [headerMenuItem release]; for (NSDictionary *favorite in [prefs objectForKey:SPQueryFavorites]) { + if (![favorite isKindOfClass:[NSDictionary class]] || ![favorite objectForKey:@"name"]) continue; NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithString:[favorite objectForKey:@"name"]] action:NULL keyEquivalent:@""]; [item setToolTip:[NSString stringWithString:[favorite objectForKey:@"query"]]]; [item setIndentationLevel:1]; diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index da5c03ae..38c76f9e 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -267,8 +267,8 @@ [prefs setObject:[NSDictionary dictionaryWithDictionary:toolbarDict] forKey:@"NSToolbar Configuration TableWindowToolbar"]; } - // For versions prior to r1263 (~0.9.7), convert the query favorites array to an array of dictionaries - if (recordedVersionNumber < 1263 && [prefs objectForKey:SPQueryFavorites]) { + // For versions prior to r1598 (~0.9.7), convert the query favorites array to an array of dictionaries + if (recordedVersionNumber < 1598 && [prefs objectForKey:SPQueryFavorites]) { NSMutableArray *queryFavoritesArray = [NSMutableArray arrayWithArray:[prefs objectForKey:SPQueryFavorites]]; for (i = 0; i < [queryFavoritesArray count]; i++) -- cgit v1.2.3