From 006cd346e930df48f52456d66456df73fe6324e9 Mon Sep 17 00:00:00 2001 From: Pradana AUMARS Date: Sat, 17 Jul 2021 13:50:54 +0200 Subject: [PATCH] In easycsv_print_columns/rows, check NULL pointer Signed-off-by: Pradana AUMARS --- src/easycsv.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/easycsv.c b/src/easycsv.c index 723e969..8a2d4b0 100644 --- a/src/easycsv.c +++ b/src/easycsv.c @@ -240,13 +240,23 @@ easycsv_read_value(const easycsv *csv, int easycsv_print_rows(const easycsv *csv) { - return csv->rows; + if (csv != NULL) { + return csv->rows; + } + else { + return -1; + } } int easycsv_print_columns(const easycsv *csv) { - return csv->cols; + if (csv != NULL) { + return csv->cols; + } + else { + return -1; + } } /*** Modifications, sort ***/