Skip to content

Commit 1710467

Browse files
committed
Account for possibility of invoking _writeString: with an empty string
1 parent b6ad3e7 commit 1710467

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

CHCSVParser/CHCSVParser/CHCSVParser.m

+4
Original file line numberDiff line numberDiff line change
@@ -643,10 +643,14 @@ - (void)_writeString:(NSString *)string {
643643
subRange.location = _bom.length;
644644
subRange.length -= _bom.length;
645645
}
646+
if (stringData.length <= 0) { return; }
647+
646648
const int8_t *bytes = stringData.bytes;
647649
if (bytes[subRange.location + subRange.length - 1] == NULLCHAR) {
648650
subRange.length -= 1;
649651
}
652+
653+
if (stringData.length <= 0) { return; }
650654
if (subRange.length != stringData.length) {
651655
stringData = [stringData subdataWithRange:subRange];
652656
}

0 commit comments

Comments
 (0)