aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPGeneralPreferencePane.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPGeneralPreferencePane.m')
-rw-r--r--Source/SPGeneralPreferencePane.m8
1 files changed, 5 insertions, 3 deletions
diff --git a/Source/SPGeneralPreferencePane.m b/Source/SPGeneralPreferencePane.m
index b87d6ab8..67c43881 100644
--- a/Source/SPGeneralPreferencePane.m
+++ b/Source/SPGeneralPreferencePane.m
@@ -77,15 +77,17 @@
[editMenuItem release];
// Select the default favorite from prefs
- [defaultFavoritePopup selectItemAtIndex:(![prefs boolForKey:SPSelectLastFavoriteUsed]) ? ([prefs integerForKey:SPDefaultFavorite] + 2) : 0];
+ [self updateDefaultFavoritePopupSelection];
}
/**
* Resets the default favorite popup button selection based on the user's preferences.
*/
-- (void)resetDefaultFavoritePopupSelection
+- (void)updateDefaultFavoritePopupSelection
{
- [defaultFavoritePopup selectItemAtIndex:(![prefs boolForKey:SPSelectLastFavoriteUsed]) ? ([prefs integerForKey:SPDefaultFavorite] + 2) : 0];
+ NSUInteger index = [prefs integerForKey:SPDefaultFavorite];
+
+ [defaultFavoritePopup selectItemAtIndex:(![prefs boolForKey:SPSelectLastFavoriteUsed] && index > 0 && index < [[defaultFavoritePopup itemArray] count]) ? index + 2 : 0];
}
#pragma mark -