Procházet zdrojové kódy

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.
Lioncash před 7 roky
rodič
revize
7ad11e3867
1 změnil soubory, kde provedl 3 přidání a 1 odebrání
  1. 3 1
      src/core/reporter.cpp

+ 3 - 1
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));