diff options
Diffstat (limited to 'csv.c')
| -rw-r--r-- | csv.c | 3 |
1 files changed, 3 insertions, 0 deletions
| @@ -257,6 +257,7 @@ csv_field(const csv_t * const csv, int idx) | |||
| 257 | 257 | ||
| 258 | if ( idx < 0 || idx >= csv->csv_field.pos ) { | 258 | if ( idx < 0 || idx >= csv->csv_field.pos ) { |
| 259 | csv_fatal_error(CSV_ERR_OUT_OF_RANGE, csv->csv_options); | 259 | csv_fatal_error(CSV_ERR_OUT_OF_RANGE, csv->csv_options); |
| 260 | return NULL; | ||
| 260 | } | 261 | } |
| 261 | 262 | ||
| 262 | return &csv->csv_string.str[csv->csv_field.fields[idx]]; | 263 | return &csv->csv_string.str[csv->csv_field.fields[idx]]; |
| @@ -275,6 +276,7 @@ csv_read(csv_t *csv, FILE *in) | |||
| 275 | 276 | ||
| 276 | if ( ferror(in) ) { | 277 | if ( ferror(in) ) { |
| 277 | csv_fatal_error(CSV_ERR_IO_READ, csv->csv_options); | 278 | csv_fatal_error(CSV_ERR_IO_READ, csv->csv_options); |
| 279 | return -1; | ||
| 278 | } | 280 | } |
| 279 | 281 | ||
| 280 | // do not try to read if EOF has already been seen | 282 | // do not try to read if EOF has already been seen |
| @@ -406,6 +408,7 @@ csv_read(csv_t *csv, FILE *in) | |||
| 406 | case STATE_END_FILE: | 408 | case STATE_END_FILE: |
| 407 | if ( ferror(in) ) { | 409 | if ( ferror(in) ) { |
| 408 | csv_fatal_error(CSV_ERR_IO_READ, csv->csv_options); | 410 | csv_fatal_error(CSV_ERR_IO_READ, csv->csv_options); |
| 411 | return -1; | ||
| 409 | } | 412 | } |
| 410 | 413 | ||
| 411 | if ( csv_string_empty(&csv->csv_string) ) { | 414 | if ( csv_string_empty(&csv->csv_string) ) { |
