Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion modules/PhysiCell_geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,9 @@ void load_cells_csv_v1( std::string filename )
std::vector<double> data;
csv_to_vector( line.c_str() , data );

if( data.size() != 4 )
if (data.size() == 0)
{ continue; } // skip blank lines
else if( data.size() != 4 )
Comment thread
drbergman marked this conversation as resolved.
{
std::cout << "Error! Importing cells from a CSV file expects each row to be x,y,z,typeID." << std::endl;
exit(-1);
Expand Down Expand Up @@ -739,6 +741,15 @@ Cell* process_csv_v2_line( std::string line , std::vector<std::string> labels )
while( std::getline( stream , s , ',' ) )
{ tokens.push_back(s); }

// check that we have enough tokens and protect against blank lines
if ( tokens.size() == 0 )
{ return NULL; }
else if (tokens.size() < 4)
{
std::cerr << "Error: CSV file expects at least 4 columns (x,y,z,cell_type) but found " << tokens.size() << std::endl;
exit(-1);
}

// get the cell position
std::vector<double> position;
char* pTemp;
Expand Down
Loading