Skip to content

Commit 57870bb

Browse files
committed
Fix CSV parser crash when init with an empty String
1 parent 7a4f681 commit 57870bb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

LocMapper/Utilities/CSVParser.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class CSVParser {
3535

3636
/* fieldNames is ignored if hasHeader is true */
3737
init(source str: String, startOffset: String.Index, separator: String, hasHeader: Bool, fieldNames: [String]?) {
38-
assert(startOffset < str.endIndex)
38+
assert(startOffset <= str.endIndex)
3939
assert(
4040
!separator.isEmpty && separator.range(of: "\"") == nil && separator.rangeOfCharacter(from: CSVParser.newLinesCharacterSet) == nil && separator.unicodeScalars.count == 1,
4141
"CSV separator string must not be empty, must contain a single unicode scalar and must not contain the double quote character or newline characters."

0 commit comments

Comments
 (0)