Skip to content

Commit

Permalink
Ignore rows with too few fields to avoid violating callers' assumptio…
Browse files Browse the repository at this point in the history
…ns later on
  • Loading branch information
gnachman committed Mar 19, 2012
1 parent dd595a6 commit 64d9967
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion TSVParser.m
Expand Up @@ -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;
}
Expand Down

0 comments on commit 64d9967

Please sign in to comment.