aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPPreferencesUpgrade.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2013-01-12 23:47:56 +0000
committerstuconnolly <stuart02@gmail.com>2013-01-12 23:47:56 +0000
commitcef4cd6f5f8c3e0278f6b1809e333af42fee5d94 (patch)
treec641c2ef397d9ce67448930404187d471d794399 /Source/SPPreferencesUpgrade.m
parent778d9814cd12318ceb303fa80f1af6d42cc8691c (diff)
downloadsequelpro-cef4cd6f5f8c3e0278f6b1809e333af42fee5d94.tar.gz
sequelpro-cef4cd6f5f8c3e0278f6b1809e333af42fee5d94.tar.bz2
sequelpro-cef4cd6f5f8c3e0278f6b1809e333af42fee5d94.zip
Small tweak to the bundle identifier migration function to prevent releasing a null reference. Fixes http://spbug.com/l/3714.
Diffstat (limited to 'Source/SPPreferencesUpgrade.m')
-rw-r--r--Source/SPPreferencesUpgrade.m22
1 files changed, 13 insertions, 9 deletions
diff --git a/Source/SPPreferencesUpgrade.m b/Source/SPPreferencesUpgrade.m
index 5b8e42be..1a7e9349 100644
--- a/Source/SPPreferencesUpgrade.m
+++ b/Source/SPPreferencesUpgrade.m
@@ -412,18 +412,21 @@ void SPMigratePreferencesFromPreviousIdentifer(void)
CFStringRef oldIdentifier = CFSTR("com.google.code.sequel-pro");
CFArrayRef oldPrefKeys = CFPreferencesCopyKeyList(oldIdentifier, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
- if (!oldPrefKeys) {
- return;
- }
+
+ if (!oldPrefKeys) return;
NSDictionary *oldPrefs = (NSDictionary *)CFPreferencesCopyMultiple(oldPrefKeys, oldIdentifier, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
- for (id eachKey in oldPrefs) {
+ for (id eachKey in oldPrefs)
+ {
[prefs setObject:[oldPrefs objectForKey:eachKey] forKey:eachKey];
}
[oldPrefs release];
- CFRelease(oldPrefKeys);
+
+ if (oldPrefKeys) {
+ CFRelease(oldPrefKeys);
+ }
}
/**
@@ -431,19 +434,20 @@ void SPMigratePreferencesFromPreviousIdentifer(void)
*/
+ (void)showPostMigrationReleaseNotes:(NSArray *)releaseNotes
{
- if (![releaseNotes count]) {
- return;
- }
+ if (![releaseNotes count]) return;
NSString *introText;
+
if ([releaseNotes count] == 1) {
introText = NSLocalizedString(@"We've made a few changes but we thought you should know about one particularly important one:", "Important release notes informational text, single change");
- } else {
+ }
+ else {
introText = NSLocalizedString(@"We've made a few changes but we thought you should know about some particularly important ones:", "Important release notes informational text, multiple changes");
}
// Create a *modal* alert to show the release notes
NSAlert *noteAlert = [[NSAlert alloc] init];
+
[noteAlert setAlertStyle:NSInformationalAlertStyle];
[noteAlert setAccessoryView:[[[NSView alloc] initWithFrame:NSMakeRect(0, 0, 450, 1)] autorelease]];
[noteAlert setMessageText:NSLocalizedString(@"Thanks for updating Sequel Pro!", @"Release notes dialog title thanking user for upgrade")];