diff --git a/quickdialog/QBindingEvaluator.m b/quickdialog/QBindingEvaluator.m index e7950cb7..239a72f6 100644 --- a/quickdialog/QBindingEvaluator.m +++ b/quickdialog/QBindingEvaluator.m @@ -134,9 +134,12 @@ - (void)fetchValueFromObject:(QElement *)element toData:(id)data { NSString *propName = [((NSString *) [bindingParams objectAtIndex:0]) stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; NSString *valueName = [((NSString *) [bindingParams objectAtIndex:1]) stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - if (![propName isEqualToString:@"iterate"] && ![valueName isEqualToString:@"self"]) - [data setValue:[element valueForKey:propName] forKeyPath:valueName]; + if (![propName isEqualToString:@"iterate"] && ![valueName isEqualToString:@"self"]) { + id value = [element valueForKeyPath:propName]; + if (propName!= nil && value!=nil) + [data setValue:value forKeyPath:valueName]; + } } } -@end \ No newline at end of file +@end diff --git a/quickdialog/QRadioElement.m b/quickdialog/QRadioElement.m index 023894e8..88d4f5a4 100644 --- a/quickdialog/QRadioElement.m +++ b/quickdialog/QRadioElement.m @@ -48,6 +48,9 @@ -(void)setItems:(NSArray *)items { } -(NSObject *)selectedValue { + if (_selected<0 || _selected>=_values.count) + return nil; + return [_values objectAtIndex:(NSUInteger) _selected]; } @@ -87,7 +90,7 @@ - (QRadioElement *)initWithDict:(NSDictionary *)valuesDictionary selected:(int)s -(void)setSelectedItem:(id)item { - if (self.items==nil) + if (self.items==nil || item==nil) return; self.selected = [self.items indexOfObject:item]; }