Skip to content

Commit

Permalink
Fix index out of bounds
Browse files Browse the repository at this point in the history
Fix index out of bounds
  • Loading branch information
CoderMJLee committed Aug 2, 2015
1 parent 1390ea7 commit 18ba7f6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion MJExtension.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "MJExtension"
s.version = "2.5.4"
s.version = "2.5.5"
s.ios.deployment_target = '6.0'
s.osx.deployment_target = '10.8'
s.summary = "The fastest and most convenient conversion between JSON and model"
Expand Down
2 changes: 1 addition & 1 deletion MJExtension/MJProperty.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ - (id)valueInObject:(id)object
if ([object isKindOfClass:[NSDictionary class]] && self.type == MJPropertyKeyTypeDictionary) {
return object[self.name];
} else if ([object isKindOfClass:[NSArray class]] && self.type == MJPropertyKeyTypeArray) {
return object[self.name.intValue];
return [object count] ? object[self.name.intValue] : nil;
}
return nil;
}
Expand Down
3 changes: 3 additions & 0 deletions MJExtension/NSObject+MJKeyValue.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import "NSObject+MJKeyValue.h"
#import "NSObject+MJProperty.h"
#import "NSString+MJExtension.h"
#import "MJProperty.h"
#import "MJType.h"
#import "MJExtensionConst.h"
Expand Down Expand Up @@ -207,6 +208,7 @@ - (instancetype)setKeyValues:(id)keyValues context:(NSManagedObjectContext *)con
}
} @catch (NSException *exception) {
MJExtensionBuildError(error, exception.reason);
NSLog(@"%@", exception);
}
return self;
}
Expand Down Expand Up @@ -405,6 +407,7 @@ - (NSMutableDictionary *)keyValuesWithKeys:(NSArray *)keys ignoredKeys:(NSArray
}
} @catch (NSException *exception) {
MJExtensionBuildError(error, exception.reason);
NSLog(@"%@", exception);
}

return keyValues;
Expand Down
Binary file not shown.

0 comments on commit 18ba7f6

Please sign in to comment.