From 64d9967aff3ed84708f61a36994e8d957c8aea6c Mon Sep 17 00:00:00 2001 From: George Nachman Date: Sun, 18 Mar 2012 21:49:05 -0700 Subject: [PATCH] Ignore rows with too few fields to avoid violating callers' assumptions later on --- TSVParser.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/TSVParser.m b/TSVParser.m index d51a9379dd..4a56495fff 100644 --- a/TSVParser.m +++ b/TSVParser.m @@ -62,7 +62,10 @@ + (TSVDocument *)documentFromString:(NSString *)string withFields:(NSArray *)fie doc.columns = [[fields copy] autorelease]; for (int i = 0; i < lines.count; i++) { NSString *row = [lines objectAtIndex:i]; - [doc.records addObject:[row componentsSeparatedByString:@"\t"]]; + NSArray *rowArray = [row componentsSeparatedByString:@"\t"]; + if (rowArray.count >= fields.count) { + [doc.records addObject:rowArray]; + } } return doc; }