From 7ad11e3867f4a7602edb8793c4c90d557d85c7c7 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 5 Jul 2019 17:02:29 -0400 Subject: 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. --- src/core/reporter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/reporter.cpp b/src/core/reporter.cpp index 774022569..79af28314 100644 --- a/src/core/reporter.cpp +++ b/src/core/reporter.cpp @@ -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)); -- cgit v1.2.3