read_line: return empty line if ifstream fails

This commit is contained in:
FlightlessMango 2021-12-13 14:33:39 +01:00
parent ac58c30bbc
commit 52ae70f650

View File

@ -14,6 +14,9 @@ std::string read_line(const std::string& filename)
{
std::string line;
std::ifstream file(filename);
if (file.fail()){
return line;
}
std::getline(file, line);
return line;
}