Add some error messages to csv_conv.c (#132)

This commit is contained in:
JaceCear authored and GitHub committed 2024-03-29 06:37:25 +00:00
1 parent 82112d8638
commit 2ba8c031be
1 file changed
+15
+15
View File
@@ -481,10 +481,25 @@ static CsvLines RemoveAllBackslashRs(CsvLines lines)
MapRegions CsvToBinaryData(char *csv_file_data, long csv_file_size, char *bin_path, TokenList tokens, bool outputBinaryFile)
{
MapRegions mapRegions = {0};
if(csv_file_data == NULL) {
fprintf(stderr, "ERROR(%s,%d): csv_file_data is nullptr\n", __FILE__, __LINE__);
return mapRegions;
}
if(csv_file_size == 0) {
fprintf(stderr, "ERROR(%s,%d): csv_file_size is 0\n", __FILE__, __LINE__);
return mapRegions;
}
CsvLines lines = GetCsvLines(csv_file_data, csv_file_size);
lines = RemoveAllBackslashRs(lines);
if(lines.list == NULL) {
fprintf(stderr, "ERROR(%s,%d): lines.list is NULL", __FILE__, __LINE__);
return mapRegions;
}
char *header = lines.list[0];
char *ident = strtok(header, ",");