Skip to content
Snippets Groups Projects
Commit c89c33a2 authored by Thomas Purcell's avatar Thomas Purcell
Browse files

Add error if feature list file is empty

should prevent seg fault kernel dead errors
parent a2ee6e60
Branches
No related tags found
No related merge requests found
Pipeline #81461 passed
......@@ -122,14 +122,15 @@ std::vector<node_ptr> str2node::phi_from_file(std::string filename, std::vector<
std::ifstream file_stream;
file_stream.open(filename, std::ios::in);
int numLines = 0;
std::string line;
std::vector<node_ptr> phi;
int feat_ind = phi_0.size();
std::getline(file_stream, line);
while(std::getline(file_stream, line))
{
++numLines;
if(line[0] == '#')
continue;
try
......@@ -148,6 +149,9 @@ std::vector<node_ptr> str2node::phi_from_file(std::string filename, std::vector<
}
}
file_stream.close();
if(numLines < 1)
throw std::logic_error("File, " + filename + " not present");
return phi;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment