core/reporter: Return in error case in SaveToFile()

If the path couldn't be created, then we shouldn't be attempting to save
the file.
This commit is contained in:
Lioncash 2019-07-05 17:02:29 -04:00
parent 772c86a260
commit 7ad11e3867
1 changed files with 3 additions and 1 deletions

View File

@ -31,8 +31,10 @@ std::string GetTimestamp() {
using namespace nlohmann;
void SaveToFile(const json& json, const std::string& filename) {
if (!FileUtil::CreateFullPath(filename))
if (!FileUtil::CreateFullPath(filename)) {
LOG_ERROR(Core, "Failed to create path for '{}' to save report!", filename);
return;
}
std::ofstream file(
FileUtil::SanitizePath(filename, FileUtil::DirectorySeparator::PlatformDefault));