modsim / FluxML

A Universal Modeling Language for Metabolic Flux Analysis
MIT License
9 stars 6 forks source link

Segmentation Fault accures when FluxML file does not exist #6

Closed ANTS-ON closed 4 years ago

ANTS-ON commented 4 years ago

When trying to instantiate the FluxMLDocument class like

flux::xml::FluxMLDocument doc("<Not existing file>"); 

an seg fault accures. GDB says it happens in line 112 of FluxMLDocument.cc when you try to get the document from the DOMReader.

It also happens in your example program when you give it an invalid fluxml path.

mbeyss commented 4 years ago

yup. if the file is not present, the reader_ object is deleted, and then referenced later. A fix is in the making. Also see #7. Right now you are most likely not getting any helpful messages, although they are generated

mbeyss commented 4 years ago

For reference. This is how it should be done

PUBLISHLOG(stderr_log);
 try
{
    flux::xml::FluxMLDocument *fml = new flux::xml::FluxMLDocument("this_file_does_not_exists.fml");
}
catch (flux::xml::XMLException& e)
{
    std::cout << "well this did not work" << std::endl;
}