test if default value exist before setting

This commit is contained in:
Jehan Monnier 2011-03-25 10:01:38 +01:00
parent 4735c62168
commit a3d87bedaf
2 changed files with 2 additions and 2 deletions

View file

@ -57,7 +57,7 @@
NSMutableDictionary *defaultsToRegister = [[NSMutableDictionary alloc] initWithCapacity:[preferences count]];
for(NSDictionary *prefSpecification in preferences) {
NSString *key = [prefSpecification objectForKey:@"Key"];
if(key) {
if(key && [prefSpecification objectForKey:@"DefaultValue"]) {
[defaultsToRegister setObject:[prefSpecification objectForKey:@"DefaultValue"] forKey:key];
}
}

View file

@ -242,7 +242,7 @@ static LinphoneCoreVTable linphonec_vtable = {
-(void) configurePayloadType:(const char*) type fromPrefKey: (NSString*)key withRate:(int)rate {
if ([[NSUserDefaults standardUserDefaults] boolForKey:key]) {
PayloadType* pt;
if(pt = linphone_core_find_payload_type(theLinphoneCore,type,rate)) {
if((pt = linphone_core_find_payload_type(theLinphoneCore,type,rate))) {
linphone_core_enable_payload_type(theLinphoneCore,pt, TRUE);
}
}