Don't crash if defaultName/defaultsDomain is nil.

This commit is contained in:
Jake Petroules committed 2014-06-29 02:03:49 -04:00
1 parent 70046f6e07
commit 8c805970fb
1 file changed
+4
+4
View File
@@ -176,6 +176,10 @@
- (id)objectForUserDefaultsKey:(NSString *)defaultName
{
if (!defaultName || !defaultsDomain) {
return nil;
}
// Under Tiger, CFPreferencesCopyAppValue doesn't get values from NSRegistrationDomain, so anything
// passed into -[NSUserDefaults registerDefaults:] is ignored. The following line falls
// back to using NSUserDefaults, but only if the host bundle is the main bundle.