mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-12-22 19:30:05 +00:00
Tolerate empty gruntwork file
This prevents the server from failing to start if a gruntwork file exists, but happens to be empty.
This commit is contained in:
parent
a9af8713bc
commit
743a39c125
@ -1075,7 +1075,9 @@ void TableData::init() {
|
||||
std::pair<json*, std::string>& table = tables[i];
|
||||
fstream.open(settings::TDATADIR + "/" + table.second); // open file
|
||||
if (!fstream.fail()) {
|
||||
fstream >> *table.first; // load file contents into table
|
||||
// tolerate empty gruntwork file
|
||||
if (!(table.first == &gruntwork && fstream.peek() == std::ifstream::traits_type::eof()))
|
||||
fstream >> *table.first; // load file contents into table
|
||||
} else {
|
||||
if (table.first != &gruntwork) { // gruntwork isn't critical
|
||||
std::cerr << "[FATAL] Critical tdata file missing: " << table.second << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user