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:
parent
772c86a260
commit
7ad11e3867
1 changed files with 3 additions and 1 deletions
|
@ -31,8 +31,10 @@ std::string GetTimestamp() {
|
||||||
using namespace nlohmann;
|
using namespace nlohmann;
|
||||||
|
|
||||||
void SaveToFile(const json& json, const std::string& filename) {
|
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);
|
LOG_ERROR(Core, "Failed to create path for '{}' to save report!", filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::ofstream file(
|
std::ofstream file(
|
||||||
FileUtil::SanitizePath(filename, FileUtil::DirectorySeparator::PlatformDefault));
|
FileUtil::SanitizePath(filename, FileUtil::DirectorySeparator::PlatformDefault));
|
||||||
|
|
Loading…
Reference in a new issue