mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 05:20: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,6 +1075,8 @@ void TableData::init() {
|
|||||||
std::pair<json*, std::string>& table = tables[i];
|
std::pair<json*, std::string>& table = tables[i];
|
||||||
fstream.open(settings::TDATADIR + "/" + table.second); // open file
|
fstream.open(settings::TDATADIR + "/" + table.second); // open file
|
||||||
if (!fstream.fail()) {
|
if (!fstream.fail()) {
|
||||||
|
// tolerate empty gruntwork file
|
||||||
|
if (!(table.first == &gruntwork && fstream.peek() == std::ifstream::traits_type::eof()))
|
||||||
fstream >> *table.first; // load file contents into table
|
fstream >> *table.first; // load file contents into table
|
||||||
} else {
|
} else {
|
||||||
if (table.first != &gruntwork) { // gruntwork isn't critical
|
if (table.first != &gruntwork) { // gruntwork isn't critical
|
||||||
|
Loading…
Reference in New Issue
Block a user