Skip to content

Commit 3223811

Browse files
committed
Merge pull request #289 from zhoupIT/master
修复小错误
2 parents 0781f67 + fe69260 commit 3223811

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

MJExtension/NSObject+MJKeyValue.m

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,11 @@ - (instancetype)setKeyValues:(id)keyValues
465465
- (instancetype)setKeyValues:(id)keyValues error:(NSError **)error
466466
{
467467
id value = [self mj_setKeyValues:keyValues];
468+
if (error != NULL) {
468469
*error = [self.class mj_error];
470+
}
469471
return value;
472+
470473
}
471474

472475
- (instancetype)setKeyValues:(id)keyValues context:(NSManagedObjectContext *)context
@@ -477,7 +480,9 @@ - (instancetype)setKeyValues:(id)keyValues context:(NSManagedObjectContext *)con
477480
- (instancetype)setKeyValues:(id)keyValues context:(NSManagedObjectContext *)context error:(NSError **)error
478481
{
479482
id value = [self mj_setKeyValues:keyValues context:context];
483+
if (error != NULL) {
480484
*error = [self.class mj_error];
485+
}
481486
return value;
482487
}
483488

@@ -494,7 +499,9 @@ - (NSMutableDictionary *)keyValues
494499
- (NSMutableDictionary *)keyValuesWithError:(NSError **)error
495500
{
496501
id value = [self mj_keyValues];
502+
if (error != NULL) {
497503
*error = [self.class mj_error];
504+
}
498505
return value;
499506
}
500507

@@ -506,7 +513,9 @@ - (NSMutableDictionary *)keyValuesWithKeys:(NSArray *)keys
506513
- (NSMutableDictionary *)keyValuesWithKeys:(NSArray *)keys error:(NSError **)error
507514
{
508515
id value = [self mj_keyValuesWithKeys:keys];
516+
if (error != NULL) {
509517
*error = [self.class mj_error];
518+
}
510519
return value;
511520
}
512521

@@ -518,7 +527,9 @@ - (NSMutableDictionary *)keyValuesWithIgnoredKeys:(NSArray *)ignoredKeys
518527
- (NSMutableDictionary *)keyValuesWithIgnoredKeys:(NSArray *)ignoredKeys error:(NSError **)error
519528
{
520529
id value = [self mj_keyValuesWithIgnoredKeys:ignoredKeys];
530+
if (error != NULL) {
521531
*error = [self.class mj_error];
532+
}
522533
return value;
523534
}
524535

@@ -530,7 +541,9 @@ + (NSMutableArray *)keyValuesArrayWithObjectArray:(NSArray *)objectArray
530541
+ (NSMutableArray *)keyValuesArrayWithObjectArray:(NSArray *)objectArray error:(NSError **)error
531542
{
532543
id value = [self mj_keyValuesArrayWithObjectArray:objectArray];
544+
if (error != NULL) {
533545
*error = [self mj_error];
546+
}
534547
return value;
535548
}
536549

@@ -542,7 +555,9 @@ + (NSMutableArray *)keyValuesArrayWithObjectArray:(NSArray *)objectArray keys:(N
542555
+ (NSMutableArray *)keyValuesArrayWithObjectArray:(NSArray *)objectArray keys:(NSArray *)keys error:(NSError **)error
543556
{
544557
id value = [self mj_keyValuesArrayWithObjectArray:objectArray keys:keys];
558+
if (error != NULL) {
545559
*error = [self mj_error];
560+
}
546561
return value;
547562
}
548563

@@ -554,7 +569,9 @@ + (NSMutableArray *)keyValuesArrayWithObjectArray:(NSArray *)objectArray ignored
554569
+ (NSMutableArray *)keyValuesArrayWithObjectArray:(NSArray *)objectArray ignoredKeys:(NSArray *)ignoredKeys error:(NSError **)error
555570
{
556571
id value = [self mj_keyValuesArrayWithObjectArray:objectArray ignoredKeys:ignoredKeys];
572+
if (error != NULL) {
557573
*error = [self mj_error];
574+
}
558575
return value;
559576
}
560577

@@ -566,7 +583,9 @@ + (instancetype)objectWithKeyValues:(id)keyValues
566583
+ (instancetype)objectWithKeyValues:(id)keyValues error:(NSError **)error
567584
{
568585
id value = [self mj_objectWithKeyValues:keyValues];
586+
if (error != NULL) {
569587
*error = [self mj_error];
588+
}
570589
return value;
571590
}
572591

@@ -578,7 +597,9 @@ + (instancetype)objectWithKeyValues:(id)keyValues context:(NSManagedObjectContex
578597
+ (instancetype)objectWithKeyValues:(id)keyValues context:(NSManagedObjectContext *)context error:(NSError **)error
579598
{
580599
id value = [self mj_objectWithKeyValues:keyValues context:context];
600+
if (error != NULL) {
581601
*error = [self mj_error];
602+
}
582603
return value;
583604
}
584605

@@ -590,7 +611,9 @@ + (instancetype)objectWithFilename:(NSString *)filename
590611
+ (instancetype)objectWithFilename:(NSString *)filename error:(NSError **)error
591612
{
592613
id value = [self mj_objectWithFilename:filename];
614+
if (error != NULL) {
593615
*error = [self mj_error];
616+
}
594617
return value;
595618
}
596619

@@ -602,7 +625,9 @@ + (instancetype)objectWithFile:(NSString *)file
602625
+ (instancetype)objectWithFile:(NSString *)file error:(NSError **)error
603626
{
604627
id value = [self mj_objectWithFile:file];
628+
if (error != NULL) {
605629
*error = [self mj_error];
630+
}
606631
return value;
607632
}
608633

@@ -614,7 +639,9 @@ + (NSMutableArray *)objectArrayWithKeyValuesArray:(id)keyValuesArray
614639
+ (NSMutableArray *)objectArrayWithKeyValuesArray:(id)keyValuesArray error:(NSError **)error
615640
{
616641
id value = [self mj_objectArrayWithKeyValuesArray:keyValuesArray];
642+
if (error != NULL) {
617643
*error = [self mj_error];
644+
}
618645
return value;
619646
}
620647

@@ -626,7 +653,9 @@ + (NSMutableArray *)objectArrayWithKeyValuesArray:(id)keyValuesArray context:(NS
626653
+ (NSMutableArray *)objectArrayWithKeyValuesArray:(id)keyValuesArray context:(NSManagedObjectContext *)context error:(NSError **)error
627654
{
628655
id value = [self mj_objectArrayWithKeyValuesArray:keyValuesArray context:context];
656+
if (error != NULL) {
629657
*error = [self mj_error];
658+
}
630659
return value;
631660
}
632661

@@ -638,7 +667,9 @@ + (NSMutableArray *)objectArrayWithFilename:(NSString *)filename
638667
+ (NSMutableArray *)objectArrayWithFilename:(NSString *)filename error:(NSError **)error
639668
{
640669
id value = [self mj_objectArrayWithFilename:filename];
670+
if (error != NULL) {
641671
*error = [self mj_error];
672+
}
642673
return value;
643674
}
644675

@@ -650,7 +681,9 @@ + (NSMutableArray *)objectArrayWithFile:(NSString *)file
650681
+ (NSMutableArray *)objectArrayWithFile:(NSString *)file error:(NSError **)error
651682
{
652683
id value = [self mj_objectArrayWithFile:file];
684+
if (error != NULL) {
653685
*error = [self mj_error];
686+
}
654687
return value;
655688
}
656689

0 commit comments

Comments
 (0)