In easycsv_print_columns/rows, check NULL pointer

Signed-off-by: Pradana AUMARS <paumars@courrier.dev>
This commit is contained in:
Pradana AUMARS 2021-07-17 13:50:54 +02:00
parent 679160e208
commit 006cd346e9
1 changed files with 12 additions and 2 deletions

View File

@ -240,13 +240,23 @@ easycsv_read_value(const easycsv *csv,
int int
easycsv_print_rows(const easycsv *csv) easycsv_print_rows(const easycsv *csv)
{ {
return csv->rows; if (csv != NULL) {
return csv->rows;
}
else {
return -1;
}
} }
int int
easycsv_print_columns(const easycsv *csv) easycsv_print_columns(const easycsv *csv)
{ {
return csv->cols; if (csv != NULL) {
return csv->cols;
}
else {
return -1;
}
} }
/*** Modifications, sort ***/ /*** Modifications, sort ***/