diff --git a/src/apps/csvdiff.cpp b/src/apps/csvdiff.cpp index 3934efa24..cfa90389c 100644 --- a/src/apps/csvdiff.cpp +++ b/src/apps/csvdiff.cpp @@ -219,7 +219,7 @@ static int breakStrCommas(char* str, char** strlets, int maxPieces) /* * Here, we ensure consistency of the file * ntitleLines of any content - * nColTitleLines of nCol columns. Each are separated by column + * nColTitleLines of nCol columns. Each are separated by column. * nDataRows of nCol columns. Each are separated by columns * Each column is identified as either a text or double. Each double entry must be able to be read * as a double. @@ -245,6 +245,13 @@ static void check_consistency(FILE* fp, const char *fileName, const int nTitleL exit(-1); } } + if (nColTitleLines == 0) { + if (nTitleLines > 0) { + fprintf(stderr, "check_consistency() error for file %s, number column title lines are zero but number title lines are greater than 0", + fileName); + exit(-1); + } + } for (int i = 0; i < nColTitleLines; i++) { retn = read_line(fp, scanLine, 0); if (retn == -1) {