From fb4d3131a958dabef17c3c58418e2601868e6f67 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Fri, 29 Oct 2010 06:43:50 +0000 Subject: =?UTF-8?q?=E2=80=A2=20try=20to=20fix=20crash=20issue=201748=20-?= =?UTF-8?q?=20it=20seems=20that=20isKindOfClass:=20method=20to=20check=20l?= =?UTF-8?q?ength=20and=20data=20type=20of=20the=20csv=20source=20while=20c?= =?UTF-8?q?reating=20a=20new=20table=20failed=20for=20empty=20cells=20or?= =?UTF-8?q?=20NULL;=20I=20tried=20to=20catch=20these=20issues=20-=20has=20?= =?UTF-8?q?to=20be=20checked=20further?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPFieldMapperController.m | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Source') diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index c8d865c8..cbaed536 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -813,12 +813,14 @@ static const NSString *SPTableViewSqlColumnID = @"sql"; } columnCounter = 0; for(id col in row) { - if([col isKindOfClass:[NSString class]] && maxLengthOfSourceColumns[columnCounter] < [col length]) { - maxLengthOfSourceColumns[columnCounter] = [col length]; - } - if(typeOfSourceColumns[columnCounter] == 1) { - if(![[[NSNumber numberWithLongLong:[col longLongValue]] stringValue] isEqualToString:col]) - typeOfSourceColumns[columnCounter] = 0; + if(col && col != [NSNull null]) { + if([col isKindOfClass:[NSString class]] && maxLengthOfSourceColumns[columnCounter] < [col length]) { + maxLengthOfSourceColumns[columnCounter] = [col length]; + } + if(typeOfSourceColumns[columnCounter] == 1) { + if(![[[NSNumber numberWithLongLong:[col longLongValue]] stringValue] isEqualToString:col]) + typeOfSourceColumns[columnCounter] = 0; + } } columnCounter++; } -- cgit v1.2.3