From 1f6ada5d53d8e6e5848d7dbb900f2634405dcf8b Mon Sep 17 00:00:00 2001 From: Motti Shneor Date: Mon, 11 Jan 2016 23:16:38 +0200 Subject: [PATCH] Fixed a crushing (exception) bug when nil fields were sent to the exporter. --- CHCSVParser/CHCSVParser/CHCSVParser.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHCSVParser/CHCSVParser/CHCSVParser.m b/CHCSVParser/CHCSVParser/CHCSVParser.m index 7c8cf34..020dfca 100644 --- a/CHCSVParser/CHCSVParser/CHCSVParser.m +++ b/CHCSVParser/CHCSVParser/CHCSVParser.m @@ -646,7 +646,7 @@ - (void)writeField:(id)field { } if (_currentLine == 0) { - [_firstLineKeys addObject:field]; + [_firstLineKeys addObject:field?:@""]; } NSString *string = field ? [field description] : @""; @@ -740,7 +740,7 @@ - (void)parser:(CHCSVParser *)parser didEndLine:(NSUInteger)recordNumber { } - (void)parser:(CHCSVParser *)parser didReadField:(NSString *)field atIndex:(NSInteger)fieldIndex { - [self.currentLine addObject:field]; + [self.currentLine addObject:field?:@""]; } - (void)parser:(CHCSVParser *)parser didFailWithError:(NSError *)error {