Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Commit 5b16639

Browse files
committed
Altered float check to also check for double
1 parent a3e7870 commit 5b16639

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Classes/NSManagedObject+ActiveRecord.m

+6-1
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ - (void)setSafeValue:(id)value forKey:(NSString *)key {
372372
else if (attributeType == NSBooleanAttributeType)
373373
value = [NSNumber numberWithBool:[value boolValue]];
374374

375-
else if (attributeType == NSFloatAttributeType)
375+
else if ([self isFloatAttributeType:attributeType])
376376
value = [NSNumber numberWithDouble:[value doubleValue]];
377377

378378
else if (attributeType == NSDateAttributeType)
@@ -388,6 +388,11 @@ - (BOOL)isIntegerAttributeType:(NSAttributeType)attributeType {
388388
(attributeType == NSInteger64AttributeType);
389389
}
390390

391+
- (BOOL)isFloatAttributeType:(NSAttributeType)attributeType {
392+
return (attributeType == NSFloatAttributeType) ||
393+
(attributeType == NSDoubleAttributeType);
394+
}
395+
391396
#pragma mark - Date Formatting
392397

393398
- (NSDateFormatter *)defaultFormatter {

0 commit comments

Comments
 (0)