Skip to content

Commit 47bc707

Browse files
committed
bug fixed
1 parent 27d13d6 commit 47bc707

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

LKDBHelper/Helper/NSObject+LKModel.m

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -968,26 +968,28 @@ + (void)getSelfPropertys:(NSMutableArray *)pronames protypes:(NSMutableArray *)p
968968
NSString* propertyClassName = nil;
969969
if ([propertyType hasPrefix:@"T@"]) {
970970

971-
NSRange range = NSMakeRange(3,MAX(0,[propertyType rangeOfString:@","].location-4));
972-
if(range.location + range.length <= propertyType.length)
971+
NSRange range = [propertyType rangeOfString:@","];
972+
if(range.location > 4 && range.location <= propertyType.length)
973973
{
974+
range = NSMakeRange(3,range.location - 4);
974975
propertyClassName = [propertyType substringWithRange:range];
975976
if([propertyClassName hasSuffix:@">"])
976977
{
977-
NSRange range = [propertyClassName rangeOfString:@"<"];
978-
if (range.length>0)
978+
NSRange categoryRange = [propertyClassName rangeOfString:@"<"];
979+
if (categoryRange.length>0)
979980
{
980-
propertyClassName = [propertyClassName substringToIndex:range.location];
981+
propertyClassName = [propertyClassName substringToIndex:categoryRange.location];
981982
}
982983
}
983984
}
984985
}
985986
else if([propertyType hasPrefix:@"T{"])
986987
{
987-
NSRange range = NSMakeRange(2, [propertyType rangeOfString:@"="].location-2);
988-
if(range.location + range.length <= propertyType.length)
988+
NSRange range = [propertyType rangeOfString:@"="];
989+
if(range.location > 2 && range.location <= propertyType.length)
989990
{
990-
propertyClassName = [propertyType substringWithRange:range];
991+
range = NSMakeRange(2, range.location-2);
992+
propertyClassName = [propertyType substringWithRange:range];
991993
}
992994
}
993995
else
@@ -1019,15 +1021,14 @@ + (void)getSelfPropertys:(NSMutableArray *)pronames protypes:(NSMutableArray *)p
10191021
}
10201022
}
10211023

1022-
if(propertyClassName.length == 0)
1024+
if([LKDBUtils checkStringIsEmpty:propertyClassName])
10231025
{
10241026
///没找到具体的属性就放弃
10251027
continue;
10261028
}
10271029
///添加属性
10281030
[pronames addObject:propertyName];
10291031
[protypes addObject:propertyClassName];
1030-
10311032
}
10321033
respondInstance = nil;
10331034
free(properties);

0 commit comments

Comments
 (0)