Permalink
Browse files

[FormMapping] Check if willDisplayCellBlock and cellSelectionBlock ar…

…e not nil
  • Loading branch information...
1 parent 31f51eb commit a85b48e26c59cf0e280e27ddb2306807caef7c7d @brunow committed May 22, 2012
Showing with 7 additions and 2 deletions.
  1. +3 −1 Code/FormMapping/BKFormMapper.m
  2. +4 −1 Code/FormMapping/BKFormModel.m
@@ -110,7 +110,9 @@ - (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *field = [self cellWithAttributeMapping:attributeMapping sourceClass:sourceClass];
if (BKFormAttributeMappingTypeCustomCell == attributeMapping.type) {
- attributeMapping.willDisplayCellBlock(field, indexPath, self.object);
+ if (nil != attributeMapping.willDisplayCellBlock) {
+ attributeMapping.willDisplayCellBlock(field, indexPath, self.object);
+ }
} else {
id value = [self valueForAttriteMapping:attributeMapping];
@@ -151,7 +151,10 @@ - (void)didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self showDatePickerWithAttributeMapping:attributeMapping];
} else if (BKFormAttributeMappingTypeCustomCell == attributeMapping.type) {
- attributeMapping.cellSelectionBlock([self cellForRowAtIndexPath:indexPath], indexPath, self.object);
+ if (nil != attributeMapping.cellSelectionBlock) {
+ UITableViewCell *cell = [self cellForRowAtIndexPath:indexPath];
+ attributeMapping.cellSelectionBlock(cell, indexPath, self.object);
+ }
}

0 comments on commit a85b48e

Please sign in to comment.