Skip to content
Snippets Groups Projects
Commit 72c76c31 authored by Odilitime's avatar Odilitime
Browse files

crash guard when there's no config file (darwin only?)

parent 97f7cbe3
No related branches found
No related tags found
No related merge requests found
......@@ -10,9 +10,13 @@ CFGFileParser::CFGFileParser(const char* filename){
cfg_file = fopen(filename, "rb"); // On NT, opening in text mode translates \n into \r\n
stat(filename, cfg_fileinfo);
buffer = static_cast<char*>(tlsf_malloc(cfg_fileinfo->st_size & INT_MAX));
bytesRead = fread(buffer, sizeof(char) & INT_MAX, cfg_fileinfo->st_size & INT_MAX, cfg_file);
if (!bytesRead) {
std::cout << "no config" << std::endl;
if (cfg_file) {
bytesRead = fread(buffer, sizeof(char) & INT_MAX, cfg_fileinfo->st_size & INT_MAX, cfg_file);
if (!bytesRead) {
std::cout << "can't read config" << std::endl;
}
} else {
std::cout << "can't open config" << std::endl;
}
fclose(cfg_file);
}
......@@ -101,4 +105,4 @@ bool CFGFileParser::ParseText() {
// object supplied by the user.
void CFGFileParser::WriteConfig(BrowserConfiguration &config){
config.Settings = cfg->Settings;
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment